public User GetById(int id) { return(_context.Users .AsNoTracking() .Where(UserQueries.GetById(id)) .FirstOrDefault()); }
public GetUserResult GetUser(Guid id) { var data = _context.Users .Where(UserQueries.GetById(id)) .FirstOrDefault(); if (data == null) { return(null); } return(new GetUserResult { Id = data.Id.ToString(), AditionalInfo = data.AditionalInfo, CountryRegistryNumber = data.Document.CountryRegistryNumber, StateRegistryNumber = data.Document.StateRegistryNumber, EmailAddress = data.Email.EmailAddress, FirstName = data.Name.FirstName, LastName = data.Name.LastName, MobilePhoneNumber1 = data.Phone.MobilePhoneNumber1, MobilePhoneNumber2 = data.Phone.MobilePhoneNumber2, PhoneNumber1 = data.Phone.PhoneNumber1, PhoneNumber2 = data.Phone.PhoneNumber2, City = data.Address.City, NeighborHood = data.Address.NeighborHood, Street = data.Address.Street, StreetNumber = data.Address.StreetNumber, ZipCode = data.Address.ZipCode, UserName = data.UserAccount.UserName, Password = data.UserAccount.DecryptPassword(), ConfirmPassword = data.UserAccount.DecryptPassword() }); }
public JsonWebToken RefreshAccessToken(string token) { var refreshToken = TokenQueries.GetRefreshToken(token); if (refreshToken == null) { throw new AuthenticationException("Refresh token was not found."); } if (refreshToken.Revoked) { throw new AuthenticationException("Refresh token was revoked"); } var user = UserQueries.GetById(refreshToken.UserId); if (user == null) { throw new AuthenticationException("User not found"); } var jwt = _jwtHandler.Create(user); jwt.RefreshToken = refreshToken.Token; return(jwt); }
public ActionResult UserProfile() { TicketUserData userData = TicketUserData.FromContext(HttpContext); User user = userQueries.GetById(userData.UserId); return(View(new UserProfileVM(user))); }
private UserModel GetUser(int idUser) { using (var context = new FcDeHoekContext()) { var user = UserQueries.GetById(context, idUser); return(new UserModel { IdUser = user.IdUser, UserName = user.UserName, IsAdmin = user.IsAdmin, Obsolete = user.Obsolete }); } }
public ActionResult SaveUser(UserModel model) { using (var context = new FcDeHoekContext()) { var user = UserQueries.GetById(context, model.IdUser); if (user == null) { user = new User(); } user.UserName = model.UserName; user.IsAdmin = model.IsAdmin; user.Obsolete = model.Obsolete; context.Users.AddOrUpdate(user); context.SaveChanges(); } return(RedirectToAction("Index", "User")); }
public ActionResult DetailsUser(int id) { return(View(userQueries.GetById(id))); }
public User GetById(Guid id) { return(_context.User.SingleOrDefault(UserQueries.GetById(id))); }