public async Task <ActionResult> Add(AddClaimViewModel viewModel) { var project = await ProjectRepository.GetProjectAsync(viewModel.ProjectId); var error = WithEntity(project); if (error != null) { return(error); } try { await _claimService.AddClaimFromUser(viewModel.ProjectId, viewModel.CharacterGroupId, viewModel.CharacterId, CurrentUserId, viewModel.ClaimText, GetCustomFieldValuesFromPost()); return(RedirectToAction( "SetupProfile", "Manage", new { checkContactsMessage = true })); } catch (Exception exception) { ModelState.AddException(exception); var source = await GetClaimSource(viewModel.ProjectId, viewModel.CharacterGroupId, viewModel.CharacterId); //TODO: Отображать ошибки верно return(View(viewModel.Fill(source, GetCurrentUser()))); } }
public async Task <ActionResult> Add(AddClaimViewModel viewModel) { var project = await ProjectRepository.GetProjectAsync(viewModel.ProjectId); if (project == null) { return(HttpNotFound()); } try { await _claimService.AddClaimFromUser(viewModel.ProjectId, viewModel.CharacterGroupId, viewModel.CharacterId, viewModel.ClaimText, GetCustomFieldValuesFromPost()); return(RedirectToAction( "SetupProfile", "Manage", new { checkContactsMessage = true })); } catch (Exception exception) { ModelState.AddException(exception); var source = await ProjectRepository.GetClaimSource(viewModel.ProjectId, viewModel.CharacterGroupId, viewModel.CharacterId).ConfigureAwait(false); return(View(viewModel.Fill(source, CurrentUserId))); } }