예제 #1
0
        public ActionResult Edit(int id, BookAutherViewModel viewModel)
        {
            try
            {
                // TODO: Add update logic here

                string fileName = ChangeFile(viewModel.File, viewModel.imgUrl);

                var  auther = autherRepository.Find(viewModel.AutherID);
                Book book   = new Book
                {
                    id          = viewModel.BookID,
                    Title       = viewModel.Title,
                    Description = viewModel.Description,
                    _auther     = auther,
                    imgURL      = fileName
                };

                bookRepository.Update(id, book);
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
예제 #2
0
 public ActionResult Edit(int id, Auther auther)
 {
     try
     {
         // TODO: Add update logic here
         autherReposetory.Update(id, auther);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }