Esempio n. 1
0
 public ActionResult Index(CustomerModel custModel)
 {
     using (CCNEntities db = new CCNEntities())
     {
         tbl_Customer tblCustomer = (custModel.id == 0) ? new tbl_Customer() : db.tbl_Customer.Where(x => x.id == custModel.id).FirstOrDefault();
         tblCustomer.FirstName   = custModel.FirstName;
         tblCustomer.LastName    = custModel.LastName;
         tblCustomer.Address     = custModel.Address;
         tblCustomer.ContactNo   = custModel.ContactNo;
         tblCustomer.BookingDate = custModel.BookingDate.ToString();
         if (custModel.id == 0)
         {
             db.tbl_Customer.Add(tblCustomer);
         }
         db.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
 public ActionResult Index(CustomerModel custModel)
 {
     using (CCNEntities db = new CCNEntities())
     {
         tbl_Customer tblCustomer = (custModel.id == 0) ? new tbl_Customer() : db.tbl_Customer.Where(x => x.id == custModel.id).FirstOrDefault();
         tblCustomer.FirstName = custModel.FirstName;
         tblCustomer.LastName = custModel.LastName;
         tblCustomer.Address = custModel.Address;
         tblCustomer.ContactNo = custModel.ContactNo;
         tblCustomer.BookingDate = custModel.BookingDate.ToString();
         if (custModel.id == 0)
         {
             db.tbl_Customer.Add(tblCustomer);
         }
         db.SaveChanges();
     }
     return RedirectToAction("Index");
 }