public ActionResult Create(TimeInterval timeinterval) { timeinterval.IntervalOwner = db.UserProfiles.Where(u => u.UserName == User.Identity.Name).First(); if (ModelState.IsValid) { db.TimeIntervals.Add(timeinterval); db.SaveChanges(); return RedirectToAction("Index"); } return View(timeinterval); }
public ActionResult Edit(TimeInterval timeinterval) { if (ModelState.IsValid ) { db.Entry(timeinterval).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(timeinterval); }