コード例 #1
0
        public ActionResult Edit(int id, Auther auther)
        {
            try
            {
                autherRepository.update(id, auther);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
コード例 #2
0
        public ActionResult Edit(int id, BookAutherViewModel model)
        {
            try
            {
                string filename = UploadFile(model.File, model.ImageURL);

                Book book = new Book
                {
                    ID          = model.bookID,
                    Title       = model.Title,
                    description = model.Description,
                    Auther      = AutherRepository.Find(model.autherID),
                    ImageURL    = filename
                };
                bookRepository.update(model.bookID, book);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }