// GET: Identifications/Create public async Task <IActionResult> Create() { var vm = new IdentificationCreateViewModel() { AppUserSelectList = new SelectList(await _bll.AppUsers.AllAsync(), nameof(BLL.App.DTO.Identity.AppUser.Id), nameof(BLL.App.DTO.Identity.AppUser.Id)) }; return(View(vm)); }
public async Task <IActionResult> Create(IdentificationCreateViewModel vm) { if (ModelState.IsValid) { _bll.Identifications.Add(vm.Identification); await _bll.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } vm.AppUserSelectList = new SelectList(await _bll.AppUsers.AllAsync(), nameof(BLL.App.DTO.Identity.AppUser.Id), nameof(BLL.App.DTO.Identity.AppUser.Id), vm.Identification.AppUserId); return(View(vm)); }