public ActionResult Create([Bind(Include = "Branch_code,Branch_pin,Branch_address,Branch_name")] Branch branch) { if (ModelState.IsValid) { db.Branches.Add(branch); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(branch)); }
public ActionResult Create([Bind(Include = "Customer_id,Customer_name,password,Address")] Customer customer) { if (ModelState.IsValid) { db.Customers.Add(customer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Create([Bind(Include = "Courier_id,Weight,Courier_type")] Courier courier) { if (ModelState.IsValid) { courier.Courier_id = (int)TempData["booking"]; db.Couriers.Add(courier); db.SaveChanges(); return(RedirectToAction("Index", "Bookings")); } else { return(Content("Invalid model")); } }
public ActionResult Create([Bind(Include = "Booking_id,From_add,Amount,Destination,Branch_code,Customer_id,Distance")] Booking booking) { if (ModelState.IsValid) { db.Bookings.Add(booking); db.SaveChanges(); TempData["courier_id"] = booking.Booking_id; return(RedirectToAction("Create", "Couriers")); } ViewBag.Branch_code = new SelectList(db.Branches, "Branch_code", "Branch_address", booking.Branch_code); ViewBag.Booking_id = new SelectList(db.Couriers, "Courier_id", "Courier_type", booking.Booking_id); ViewBag.Customer_id = new SelectList(db.Customers, "Customer_id", "Customer_name", booking.Customer_id); return(View(booking)); }