Пример #1
0
        // 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));
        }
Пример #2
0
        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));
        }