Пример #1
0
 public IActionResult Post([FromBody] CreateGuestViewModel createGuestViewModel)
 {
     try
     {
         Guest guest = new Guest()
         {
             ID   = createGuestViewModel.ID,
             Name = createGuestViewModel.Name
         };
         iGuestRepository.CreateGuest(guest);
         Uri uri = new Uri(Url.Link("GetGuestByID", new { Id = guest.ID }));
         iUnitOfWork.Save();
         return(Created(uri, guest.ID.ToString()));
     }
     catch (Exception ex)
     {
         return(Content(ex.ToString(), BadRequest().ToString()));
     }
 }