// GET: User/Details/5 public ActionResult Details(string id) { IdentityUser rawUser = _userAdminManager.FindById(id); UserViewModel model = new UserViewModel { Id = rawUser.Id, UserName = rawUser.UserName, Role = _userManager.GetRolesAsync(rawUser).Result.First(), Roles = _context.Roles.OrderBy(x => x.Name) }; return(View(model)); }
public async Task <IActionResult> Create(/*[Bind("Notice.Id,Notice.Subject,Notice.Description,Notice.CreatedAt,Notice.IsActive")]*/ NoticeViewModel viewModel) { NoticeViewModel noticeViewModel = new NoticeViewModel { Categories = _categoryAdminManager.findAll(), Users = _userAdminManager.FindAll() }; if (ModelState.IsValid) { if (viewModel.Notice != null) { Notice notice = viewModel.Notice; notice.Category = _categoryAdminManager.FindById(viewModel.CategoryId).Result; notice.Creator = _userAdminManager.FindById(viewModel.CreatorId); await _noticesAdminManager.Add(notice); return(RedirectToAction(nameof(Index))); } } return(View(noticeViewModel)); }