예제 #1
0
        public async Task <ResponseDto <BaseModelDto> > InsertLeagueAsync(AddLeagueBindingModel model)
        {
            var response = new ResponseDto <BaseModelDto>();

            var league = _leagueRepository.GetByName(model.Name);

            if (league != null)
            {
                response.Errors.Add(ServiceErrors.LEAGUE_ALREADY_EXISTS);
                return(response);
            }
            league = new League()
            {
                Name     = model.Name,
                Quantity = model.Quantity,
                Teams    = new List <Team>()
            };
            await _leagueRepository.InsertAsync(league);

            return(response);
        }
예제 #2
0
 public LeagueViewModel GetByName(string name)
 {
     return(mapper.MapDomainToModel(leagueRepository.GetByName(name)));
 }