public async Task <UserEditGetModel> GetForEdit(int id) { UserEditGetModel userEditGetModel = new UserEditGetModel { Roles = _roleService.GetAll(), UserTypes = await _userTypeService.GetAll() }; var userTbl = await _context.UsersTbl .Include(u => u.UserDetailsTbl) .Where(u => u.UserId == id && !u.UserDetailsTbl.IsDeleted) .AsNoTracking() .SingleOrDefaultAsync(); //if no user is found then show error if (userTbl == null) { throw new NotFoundException(UserValidationMessage.USER_NOT_FOUND); } userEditGetModel.User = _mapper.Map <UserModel>(userTbl); userEditGetModel.UserDetailsBaseAdmin = _mapper.Map <UserDetailsBaseAdminModel>(userTbl.UserDetailsTbl); return(userEditGetModel); }
public async Task <IActionResult> Edit(string id) { IEnumerable <RoleViewModel> lstRoles = await ApiInvoker.GetAsync <IEnumerable <RoleViewModel> >(APIURL.IdentityBaseUri + IdentityAPI.Role.GetAll); var objParam = new { id = id }; UserEditGetModel user = await ApiInvoker.PostAsync <UserEditGetModel>(objParam, APIURL.IdentityBaseUri + IdentityAPI.User.GetByID); await BindRoleList(user.UserInRoles); Dictionary <string, string> _localLabel = await LocalizeData(LocalizePath); ViewData["LocalLabel"] = _localLabel; return(View("Edit", user)); }
public async Task <IActionResult> ResetPassword(string id) { IEnumerable <RoleViewModel> lstRoles = await ApiInvoker.GetAsync <IEnumerable <RoleViewModel> >(APIURL.IdentityBaseUri + IdentityAPI.Role.GetAll); var objParam = new { id = id }; UserEditGetModel user = await ApiInvoker.PostAsync <UserEditGetModel>(objParam, APIURL.IdentityBaseUri + IdentityAPI.User.GetByID); ResetPassword reset = new ResetPassword(); if (user != null) { reset.UserName = user.UserName; } Dictionary <string, string> _localLabel = await LocalizeData(LocalizePath); ViewData["LocalLabel"] = _localLabel; return(View("ResetPassword", reset)); }