public LeagueModel UpdateLeague(UpdateLeagueModel model) { if (model.IsCompleted) { DeleteExtraLeagueMatches(model.Id); SetWinnerPlayer(model.Id); } var command = @" UPDATE League SET TypeId = @TypeId, Iteration = @Iteration, StartDate = @StartDate, EndDate = @EndDate, IsCompleted = @IsCompleted, Title = @Title WHERE Id = @Id"; var result = ExecCommand(command, model); if (result) { return new LeagueModel { Id = model.Id, TypeId = model.TypeId, StartDate = model.StartDate, EndDate = model.EndDate, IsCompleted = model.IsCompleted, Title = model.Title } } ; return(null); }
public LeagueModel UpdateLeague(long id, UpdateLeagueModel model) { model.Id = id; return(_leagueLib.UpdateLeague(model)); }