示例#1
0
 public ActionResult Edit([Bind(Include = "SupplierID,SupplierName,Address,Destination,Email,TelephoneSupplier")] Supplier supplier)
 {
     //check if supplier object is valid and then save the change in db.Suppliers, finally return to the same page with object after change
     if (ModelState.IsValid)
     {
         db.Entry(supplier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(supplier));
 }
示例#2
0
        public ActionResult Edit([Bind(Include = "CustomerID,PassportNum,FirstName,LastName,BirthDate,Address,PhoneNum,Email,JoinDate")] Customer customer)
        {
            //check if customer object is valid and then save the change in db.customers, finally return to the same page with object after change
            if (ModelState.IsValid)
            {
                db.Entry(customer).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
示例#3
0
        public ActionResult Edit([Bind(Include = "LocationId,Name,Description,Latitude,Longitude,ZIndex")] Location location)
        {
            //check if location object is valid and then save the change in db.Location, finally return with the object after change to the same page
            if (ModelState.IsValid)
            {
                db.Entry(location).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(location));
        }
示例#4
0
 public ActionResult Edit([Bind(Include = "OrderID,CustomerID,VacationPackageID,PassengersNum,Total,OrderDate")] Order order)
 {
     //check if order object is valid and then save the change in db.Orders, finally return to the same page with object after change
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID        = new SelectList(db.Customers, "CustomerID", "PassportNum", order.CustomerID);
     ViewBag.VacationPackageID = new SelectList(db.VacationPackages, "VacationPackageID", "Destination", order.VacationPackageID);
     return(View(order));
 }
示例#5
0
 public ActionResult Edit(VacationPackage vacationpackage, HttpPostedFileBase file)
 {
     //check if VacationPackage object is valid and then save the change in db.VacationPackage, finally return to the same page with object after change
     if (ModelState.IsValid)
     {
         db.Entry(vacationpackage).State = EntityState.Modified;
         //check if file is not null-save change and return to Index page
         if (file != null)
         {
             //save upload image in project and his name in db
             file.SaveAs(HttpContext.Server.MapPath("~/img/") + file.FileName);
             vacationpackage.Image = file.FileName;
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SupplierID = new SelectList(db.Suppliers, "SupplierID", "SupplierName", vacationpackage.SupplierID);
     return(View(vacationpackage));
 }