public ActionResult Edit(Referee referee) { if (ModelState.IsValid) { refereeService.Update(referee); refereeService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return RedirectToAction("Index"); } return View(referee); }
public Fixture MapToFixture(Fixture fixture, TeamLeague homeTeamLeague, TeamLeague awayTeamLeague, Referee referee1, Referee referee2, User lastUpdatedBy, OneOffVenue oneOffVenue) { fixture.HomeTeamLeague = homeTeamLeague; fixture.AwayTeamLeague = awayTeamLeague; fixture.LastUpdatedBy = lastUpdatedBy; fixture.LastUpdated = DateTime.Now; // If you remove the few lines below accessing the referee objects you cannot reliably // set the properties to null. The assignment seems to be ignored. // By best guess is that the properties aren't lazy loaded until accessed so if you assign // a value to the property then read from it, the value gets loaded from the database. F****d up. fixture.Referee1.Touch(); fixture.Referee2.Touch(); fixture.Referee1 = referee1; fixture.Referee2 = referee2; fixture.OneOffVenue.Touch(); fixture.OneOffVenue = oneOffVenue; return fixture; }