public ActionResult Create() { if (Session["LogonUser"] == null) { return(RedirectToAction("Login", "User", null)); } addScheduleViewModel asvm = new addScheduleViewModel(); asvm.listShipnum = new List <SelectListItem>(); loadShipnum(asvm.listShipnum); asvm.listStatus = new List <SelectListItem>(); loadStatus(asvm.listStatus); return(View(asvm)); }
public ActionResult Create(addScheduleViewModel asvm) { var schedule = new Schedule(); using (Model1Container container = new Model1Container()) { schedule.departure = asvm.departure; schedule.destination = asvm.destination; schedule.weight = asvm.weight; schedule.deliver_date = asvm.deliver_date; container.Schedules.Add(schedule); container.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult addContainer(addScheduleViewModel asvmn) { var con = new Container(); using (Model1Container container = new Model1Container()) { con.ContainerID = asvmn.containerid; con.ContainerOutDate = asvmn.containeroutdate; con.Destination = asvmn.destination; con.Weight = asvmn.weight; con.Status = "Waiting for Ship"; container.Containers.Add(con); container.SaveChanges(); } return(RedirectToAction("../Schedule/Index")); }