示例#1
0
 public ActionResult Add(string Name, string PublishingCompany,
                         DateTime PublishingDate, string Size, int NumberOfPages, string CoverType,
                         int BookTypeID, int AuthorID, double Price, HttpPostedFileBase file, int Discount)
 {
     try
     {
         string _path = "";
         if (file.ContentLength > 0)
         {
             string _FileName = Path.GetFileName(file.FileName);
             _path = Path.Combine(Server.MapPath("~/UploadedFiles"), _FileName);
             file.SaveAs(_path);
             BookAction.AddBook(Name, PublishingCompany, PublishingDate, Size,
                                NumberOfPages, CoverType, BookTypeID, AuthorID, _FileName, Price, Discount);
         }
         return(RedirectToAction("Add"));
     }
     catch
     {
         return(RedirectToAction("Add"));
     }
 }
示例#2
0
 public override void AddExecute(object sender)
 {
     ListBook.Books = BookAction.AddBook(Dialog, ListBook.Books);
     Json.Serialize(ListBook.NameShelf, ListBook);
 }