public ActionResult Edit(OneOffVenue oneOffVenue) { if (ModelState.IsValid) { oneOffVenueService.Update(oneOffVenue); oneOffVenueService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return(RedirectToAction("Index")); } return(View(oneOffVenue)); }
public ActionResult Delete(int id) { OneOffVenue oneOffVenue = oneOffVenueService.Get(id); if (oneOffVenue != null) { oneOffVenueService.Delete(oneOffVenue); oneOffVenueService.Commit(); SuccessMessage(FormMessages.DeleteSuccess); } return(RedirectToAction("Index")); }
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); }