public async Task <ActionResult> EditModal(long userId) { var user = await _userAppService.GetAsync(new EntityDto <long>(userId)); var roles = (await _userAppService.GetRoles()).Items; var userTypeSelectListItems = (await _lookupAppService.GetUserTypeComboboxItems()).Items .Select(p => p.ToSelectListItem()) .ToList(); userTypeSelectListItems.Find(x => x.Value == user.UserTypeId.ToString()).Selected = true; var genderMasterId = (await _lookupAppService.GetAllLookUpMaster(null, "Gender")).Items.FirstOrDefault().Id; var genderSelectListItems = (await _lookupAppService.GetLookDetailComboboxItems(genderMasterId)).Items .Select(p => p.ToSelectListItem()) .ToList(); genderSelectListItems.Find(x => x.Value == user.Gender.ToString()).Selected = true; var model = new EditUserModalViewModel { User = user, Roles = roles, UserType = userTypeSelectListItems, Gender = genderSelectListItems }; return(PartialView("_EditModal", model)); }
public async Task<ActionResult> EditUserModal(long userId) { var user = await _userAppService.Get(new EntityDto<long>(userId)); var roles = (await _userAppService.GetRoles()).Items; var model = new EditUserModalViewModel { User = user, Roles = roles }; return View("_EditUserModal", model); }
public async Task <PartialViewResult> EditUserModal(string userKey) { var user = _userAppService.GetUserByKey(userKey); var roles = (await _userAppService.GetRoles()).Items; var model = new EditUserModalViewModel { User = user, Roles = roles }; return(PartialView("_EditUserModal", model)); }
public async Task <IActionResult> CreatOrEdit(int userId) { EditUserModalViewModel model = new EditUserModalViewModel(); if (userId > 0) { model.User = await _userService.GetAsync(userId); model.Roles = (IReadOnlyList <RoleDto>)(_roleService.GetAll().ToList()); return(View(model)); } return(View()); }
public async Task <ActionResult> EditUserModal(long userId) { var user = await userAppService.Get(new EntityDto <long>(userId)); var roles = (await roleAppService.GetAll(new PagedResultRequestDto { MaxResultCount = int.MaxValue })).Items; var model = new EditUserModalViewModel { User = user, Roles = roles }; return(View("_EditUserModal", model)); }
public async Task <ActionResult> Add(long?userId) { var user = await _userAppService.Get(new EntityDto <long>((long)userId)); List <RoleDropDownDto> dtoList = (await _roleAppService.GetDropDown()); var model = new EditUserModalViewModel { User = user, Roles = dtoList }; EditUserModalViewModel s = new EditUserModalViewModel(); return(View("_Add", model)); }
public async Task <ActionResult> EditModal(long userId) { var user = await _userAppService.GetAsync(new EntityDto <long>(userId)); var dict = await ds.FindListAsync(x => x.ParentId == (int)EnumList.Location); var roles = (await _userAppService.GetRoles()).Items; var model = new EditUserModalViewModel { User = user, Roles = roles, Dicts = dict }; return(PartialView("_EditModal", model)); }
public ActionResult Edit(EditUserModalViewModel editUserModalViewModel) { if (ModelState.IsValid) { var input = editUserModalViewModel.User; Users.Dto.UpdateUserDto inputUser = new Users.Dto.UpdateUserDto { Id = input.Id, EmailAddress = input.EmailAddress, IsActive = input.IsActive, Name = input.Name, RoleNames = input.Roles, Surname = input.Surname, UserName = input.UserName }; _userAppService.Update(inputUser); } return(View(editUserModalViewModel)); }
public async Task <IActionResult> List( int page = 1, int pageSize = 10, string RoleId = "", string Name = "", string BusinessId = "") { string where = string.Empty; if (!string.IsNullOrEmpty(Name)) { where += $" and s.UserName like '%{Name}%'"; } if (!string.IsNullOrEmpty(RoleId)) { where += $" and RoleId = {RoleId}"; } if (!string.IsNullOrEmpty(BusinessId)) { where += $" and r.BusinessId = {BusinessId}"; } int total; DataSet ds = _userAppService.GetUserPage(page, pageSize, "id desc", out total, where); IPagedList pageList = new PagedList <DataRow>(ds.Tables[0].Select(), page, pageSize, total); if (Request.Headers.ContainsKey("x-requested-with")) { return(View("_Table", pageList)); } List <RoleDropDownDto> dtoList = (await _roleAppService.GetDropDown()); ViewData.Add("Roles", new SelectList(dtoList, "Id", "DisplayName")); List <BusinessDropDownDto> businessdtoList = (await _AppService.GetDropDown()); ViewData.Add("Business", new Microsoft.AspNetCore.Mvc.Rendering.SelectList(businessdtoList, "Id", "BusinessName")); EditUserModalViewModel s = new EditUserModalViewModel(); s.User = new UserDto(); s.Roles = dtoList; ViewBag.EditUser = s; return(View(pageList)); }