private HistoricStatsModel MapHistoricStatToModel(HistoricStats stat) { return(new HistoricStatsModel { Assists = stat.Assists, Goals = stat.Goals, IdPlayer = stat.IdPerson, IdSeason = stat.IdSeason, IdHistoricStats = stat.IdHistoricStats, Penalties = stat.Penalties, Player = GetPlayerName(stat.IdPerson), Season = GetSeason(stat.IdSeason) }); }
public ActionResult Save(HistoricStatsModel model) { using (var context = new FcDeHoekContext()) { var historicStat = new HistoricStats(); historicStat.IdHistoricStats = model.IdHistoricStats; historicStat.IdSeason = model.IdSeason; historicStat.IdPerson = model.IdPlayer; historicStat.Goals = model.Goals; historicStat.Assists = model.Assists; historicStat.Penalties = model.Penalties; context.HistoricStatses.AddOrUpdate(historicStat); context.SaveChanges(); return(RedirectToAction("Index")); } }