Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
        // GET: Book
        public ActionResult Index()
        {
            List <BookType> a = new List <BookType>();

            a = BookAction.ListBookType();
            return(PartialView(a));
        }
Beispiel #3
0
        public ActionResult Add()
        {
            Book book = new Book
            {
                AuthorCollection   = AuthorAction.ListAuthor(),
                BookTypeCollection = BookAction.ListBookType()
            };

            ViewBag.ListBook = BookAction.ListBook();
            return(View(book));
        }