E
E
Evgeny Semashko2020-05-19 22:17:47
C++ / C#
Evgeny Semashko, 2020-05-19 22:17:47

How to make a request to compare login and password?

How to pull the login and password from the database and compare them with the input data that was entered intextbox

using (ApplicationContext db = new ApplicationContext(options))
            {
                var loginDates = db.Users.FromSqlRaw("SELECT Email, Password FROM Users").ToList();

                if(loginDates.Contains())
                {

                }
                    
            }


If you take this code, then you need an overload in the form User item, tried to overload with a parameter new User(_email, password), but the entity object does not contain a constructor with accepted parameters, that is, there was an idea to pass the login and date through variables and compare with the data from the database.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-05-20
@evgenysemashko

Look at the documentation. Add a provider and manage your application through it.
Everything you need is already there. There and password strength and recovery and much more.
https://docs.microsoft.com/en-us/aspnet/core/secur...
Updated
On the "Services" project tab, select "Enable client application services"
https://docs.microsoft.com/en-us/ visualstudio/ide/...
Then you get all the same only from the studio (not quite of course, but the studio will add blanks)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question