public ActionResult Edit(int ID, string Name, string PublishingCompany, DateTime PublishingDate, string Size, int NumberOfPages, string CoverType, int BookTypeID, int AuthorID, double Price, HttpPostedFileBase file, int Discount) { Book book = new Book { AuthorCollection = AuthorAction.ListAuthor(), BookTypeCollection = BookAction.ListBookType() }; ViewBag.book = BookAction.FindBook(ID); try { string _path = ""; if (file.ContentLength > 0) { string _FileName = Path.GetFileName(file.FileName); _path = Path.Combine(Server.MapPath("~/UploadedFiles"), _FileName); file.SaveAs(_path); BookAction.EditFullBook(ID, Name, PublishingCompany, PublishingDate, Size, NumberOfPages, CoverType, BookTypeID, AuthorID, _FileName, Price, Discount); } ViewBag.Message = "Updated Successfully"; return(View(book)); } catch { ViewBag.Message = "Updated Fail!"; return(View(book)); } }
public ActionResult ListAuthor() { if (Session["UserName"] != null && (int)Session["Role"] == 1) { ViewBag.ListAuthor = AuthorAction.ListAuthor(); return(View()); } return(RedirectToAction("Login", "Account")); }
public ActionResult Add() { Book book = new Book { AuthorCollection = AuthorAction.ListAuthor(), BookTypeCollection = BookAction.ListBookType() }; ViewBag.ListBook = BookAction.ListBook(); return(View(book)); }
public ActionResult ListAuthor() { ViewBag.ListAuthor = AuthorAction.ListAuthor(); return(View()); }