public ActionResult Create(AuthorSinglePageViewModel model) { CreateAuthorRequest request = model.AuthorViewModel.ConvertToCreateNationalityRequest(); CreateAuthorResponse response = _authorService.CreateAuthor(request); if (response.Success) { return(RedirectToAction("Index")); } else { model.Success = false; model.Message = response.Message; return(View(model)); } }
public CreateAuthorResponse CreateAuthor(CreateAuthorRequest request) { CreateAuthorResponse response = new CreateAuthorResponse(); try { Author author = request.ConvertToAuthor(); _authorRepository.Create(author); response.Success = true; } catch (Exception ex) { response.Success = false; response.Message = ex.Message; } return(response); }
public async Task CreateAnAuthor() { _response = await _useCase.Handle(_request); }