Exemple #1
0
        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);
        }
Exemple #2
0
 public LeagueModel UpdateLeague(long id, UpdateLeagueModel model)
 {
     model.Id = id;
     return(_leagueLib.UpdateLeague(model));
 }