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); }
public LeagueViewModel GetByName(string name) { return(mapper.MapDomainToModel(leagueRepository.GetByName(name))); }