public ActionResult Edit(int id) { var model = new WeekEditModel(); var week = WeekRepository.WeekFetch(id); model.Title = "Week Edit"; model.Week = week; return this.View(model); }
public ActionResult Edit(int id, FormCollection collection) { var model = new WeekEditModel(); var week = WeekRepository.WeekFetch(id); this.Map(collection, week); week = WeekRepository.WeekSave(week); if (week.IsValid) { return this.RedirectToAction("Index", new { year = week.Year }); } model.Title = "Week Edit"; model.Week = week; ModelHelper.MapBrokenRules(this.ModelState, week); return this.View(model); }