コード例 #1
0
 public async Task <ActionResult> Create(AuthorsView newAthor)
 {
     try
     {
         var done = _authorsService.Edit(_mapper.Map <AuthorsView, IAuthors>(newAthor));
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #2
0
        public async Task <ActionResult <AuthorsViewModel> > PostAuthors([FromBody] AuthorsViewModel author)
        {
            var newAuthor = await _authorsService.Edit(_mapper.Map <AuthorsViewModel, IAuthors>(author));

            return(CreatedAtAction(nameof(Get), new { id = newAuthor.ID }, newAuthor));
        }