public ActionResult UserLeagueEdit(UserLeagueEdit model) { var service = CreateLeagueService(); service.UpdateUserLeagueScore(model); return(RedirectToAction($"PlayLeagueRound/{model.LeagueId}")); }
public ActionResult UserLeagueEdit(string id, int leagueId) { var service = CreateLeagueService(); var detail = service.GetPlayerById(id); var model = new UserLeagueEdit { Score = detail.Score, ID = detail.Id, LeagueId = leagueId, PlayerName = detail.FirstName + " " + detail.LastName }; return(View(model)); }
public bool UpdateUserLeagueScore(UserLeagueEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .UserLeagues .SingleOrDefault (e => e.UserId == model.ID && e.LeagueId == model.LeagueId); if (entity is null) { return(false); } entity.RoundScore = model.Score; return(ctx.SaveChanges() == 1); } }