public ActionResult NewRace([Bind(Exclude = "TimeOfHistoryCreated")] RacingViewModel raceModel) { if (ModelState.IsValid) { this.raceService.AddNewRaceHistory(raceModel); return(RedirectToAction("NewRace", "Race")); } return(View(raceModel)); }
public void AddNewRaceHistory(RacingViewModel raceModel) { var raceHistory = new RacingHistories() { FrontTiresPressure = raceModel.FrontTiresPressure, RearTiresPressure = raceModel.RearTiresPressure, FrontCoiloverClicks = raceModel.RearCoiloverClicks, RearCoiloverClicks = raceModel.RearCoiloverClicks, Notes = raceModel.Notes, TimeOfHistoryCreated = DateTime.Now, BestTimeOfTheDay = raceModel.BestLapTimeOfTheDay, Tracks = raceModel.Tracks, Tyres = raceModel.Tyres }; this.Context.RaceingHistorieses.Add(raceHistory); this.Context.SaveChanges(); }