public async Task <IActionResult> UpdateEmailConfirmed(UpdateEmailAccountViewModel vm) { if (ModelState.IsValid) { var result = await _accountService.UpdateEmailAsync(_mapper.Map <AccountDTO>(vm)); if (result.IsValid) { return(RedirectToAction("Index")); } TempData["ErrorsListConfirmed"] = result.ErrorsList; } return(View(vm)); }
public async Task <IActionResult> Create(UpdateEmailAccountViewModel viewModel) { if (ModelState.IsValid) { var entity = _mapper.Map <EmailAccount>(viewModel); await _emailAccountService.CreateAsync(entity); // var activityLog = GetActivityLog(entity.GetType(), newValue: emailAccount); // await _activityLogService.CreateAsync(GetSystemKeyword(), activityLog); return(RedirectToAction(nameof(Index))); } return(View("Update", viewModel)); }
public async Task <IActionResult> UpdateEmailConfirmed(UpdateEmailAccountViewModel vm) { if (ModelState.IsValid) { var result = await _accountService.UpdateEmailAsync(_mapper.Map <AccountDTO>(vm)); if (result.IsValid) { await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Update, Tables.AspNetUsers, "Email"); return(RedirectToAction("Index")); } TempData["ErrorsListConfirmed"] = result.ErrorsList; } return(View(vm)); }
public async Task <IActionResult> UpdateEmailConfirmed(UpdateEmailAccountViewModel vm) { if (ModelState.IsValid) { if (vm.HashIdUser == null) { return(NotFound()); } var result = await _accountService.UpdateUserEmailAsync(_mapper.Map <AccountDTO>(vm)); return(result.IsValid ? RedirectToAction("Index") : _oops.OutPutError("Account", "Index", result.ErrorsList)); } return(View(vm)); }
public async Task <IActionResult> Update(UpdateEmailAccountViewModel viewModel) { if (ModelState.IsValid) { EmailAccount entity = await _emailAccountService.FindAsync(viewModel.Id); if (entity == null) { return(RedirectToAction(nameof(Index))); } //var activityLog = GetActivityLog(entity.GetType(), oldValue: emailAccount); var updatedEntity = _mapper.Map(viewModel, entity); await _emailAccountService.UpdateAsync(updatedEntity); // activityLog.NewValue = ObjectToJson(updatedEntity); // await _activityLogService.CreateAsync(GetSystemKeyword(), activityLog); return(RedirectToAction(nameof(Index))); } return(View("Update", viewModel)); }