Esempio n. 1
0
 public ActionResult Create(PublisherModel model)
 {
     try
     {
         Publisher publisher = new Publisher()
         {
             Name        = model.Name,
             Address     = model.Address,
             PhoneNumber = model.PhoneNumber
                           //Year = model.Year.ToString()
         };
         context.Publishers.InsertOnSubmit(publisher);
         context.SubmitChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model));
     }
 }
Esempio n. 2
0
 public ActionResult Create(CustomerModel model)
 {
     try
     {
         Customer customer = new Customer()
         {
             ReferenceId = model.ReferenceId,
             FirstName   = model.FirstName,
             LastName    = model.LastName,
             Address     = model.Address,
             Mobile      = model.Mobile
                           //Year = model.Year.ToString()
         };
         context.Customers.InsertOnSubmit(customer);
         context.SubmitChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model));
     }
 }
Esempio n. 3
0
 public ActionResult Create(BookModel model)
 {
     try
     {
         BOOK book = new BOOK()
         {
             Title       = model.Title,
             Author      = model.Author,
             Year        = model.Year,
             Price       = model.Price,
             ISBN        = model.ISBN,
             StockLevel  = model.StockLevel,
             PublisherId = model.PublisherId
         };
         context.BOOKs.InsertOnSubmit(book);
         context.SubmitChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model));
     }
 }
Esempio n. 4
0
 public ActionResult Create(TestModel model)
 {
     try
     {
         var queryPrice = (from book in context.BOOKs
                           where book.Id == model.BookId
                           select book.Price);
         Test test = new Test()
         {
             Quantity   = model.Quantity,
             BookId     = model.BookId,
             CustomerId = model.CustomerId,
             OrderDate  = model.OrderDate,
             Price      = queryPrice.First()
         };
         context.Tests.InsertOnSubmit(test);
         context.SubmitChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model));
     }
 }