public async Task <IActionResult> Create([Bind("ChildId,FirstName,LastName")] Child child) { if (ModelState.IsValid) { await _childrenService.CreateAsync(child); return(RedirectToAction(nameof(Index))); } return(View(child)); }
public async Task <IActionResult> Create(CreateChildrenViewModel vm) { if (ModelState.IsValid) { var result = await _services.CreateAsync(_mapper.Map <ChildrenDTO>(vm)); if (result.IsValid) { await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Insert, Tables.Children); return(RedirectToAction("Index", new { id = vm.HashIdEmployee })); } TempData["ErrorsList"] = result.ErrorsList; } return(View(vm)); }