public ActionResult Edit(LessonsTime lesson) { if (ModelState.IsValid) { _db.Lessons.Edit(lesson); _db.SaveChanges(); return RedirectToAction("Index"); } return View(lesson); }
public JsonResult Edit(FormCollection form) { int h = 0; int m = 0; int id = 0; if (int.TryParse(form[0], out h) && int.TryParse(form[1], out m) && int.TryParse(form[2], out id)) { var lesson = new LessonsTime() { Hours = h, Minutes = m, LessonId = id }; _db.Lessons.Edit(lesson); _db.SaveChanges(); return Json(lesson.Time.ToShortTimeString()); } return Json(false); }