public async Task <string> LoginUserInApp(ModelForLogin model) { LoginModel modelDb = db.AuthData.FirstOrDefault(a => a.Email == model.Email); if (modelDb != null && modelDb.Password == GetHashImage(model.Password, modelDb.Salt)) { int userId = db.Users.FirstOrDefault(u => u.LoginId == modelDb.LoginId).UserId; await Authenticate(model.Email); RegisterSession(userId); return("/Content/NamedPage"); } return(null); }
public async Task <string> LoginUser([FromBody] ModelForLogin model) { return(await transfer.LoginUserInApp(model)); }