Пример #1
0
 public ActionResult Create(BookEditViewModel viewModel)
 {
     try
     {
         var bookDto = new BookSaveDto
         {
             Id = viewModel.Id,
             AuthorId = viewModel.AuthorId,
             Name = viewModel.Name,
             Price = viewModel.Price
         };
         this.booksUseCase.Create(bookDto);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Пример #2
0
 // GET: Books/Edit/5
 public ActionResult Edit(int id)
 {
     var bookDto = this.booksUseCase.GetBookDetail(id);
     var book = new BookEditViewModel { Id = bookDto.Id, ISBN = bookDto.ISBN, Name = bookDto.Name, Price = bookDto.Price };
     return View(book);
 }