public ActionResult Create(LunchRegister Lunchregister) { Lunchregister.LunchDate = Utilities.ToDateWithTimeZone(DateTime.Now.ToUniversalTime(), Utilities.ChinaTimeZoneId).Date; if (ModelState.IsValid) { db.LunchRegisters.Add(Lunchregister); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.User_id = new SelectList(db.Users, "User_id", "UserName", Lunchregister.User_id); return View(Lunchregister); }
public ActionResult Edit(LunchRegister Lunchregister) { if (ModelState.IsValid) { db.Entry(Lunchregister).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.User_id = new SelectList(db.Users, "User_id", "UserName", Lunchregister.User_id); return View(Lunchregister); }