Example #1
0
        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));
            }
        }
Example #2
0
        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);
        }
Example #3
0
 public async Task CreateAnAuthor()
 {
     _response = await _useCase.Handle(_request);
 }