internal static Season Convert(DatabaseAccess.ExternalModel.Season season) { Season newSeason = new Season(); newSeason.SeasonId = season.SeasonId; newSeason.ShortName = season.ShortName; newSeason.LongName = season.LongName; newSeason.StartDate = season.StartDate; newSeason.EndDate = season.EndDate; newSeason.WinterSeason = season.WinterSeason; return(newSeason); }
public async Task <IHttpActionResult> Get(string seasonReference) { bool converts = int.TryParse(seasonReference, out int seasonId); if (converts == false) { return(BadRequest()); } DatabaseAccess.ExternalModel.Season databaseSeason = await _seasonRepository.GetSeasonAsync(seasonId); Models.Season season = Models.Season.Convert(databaseSeason); season.Link = Url.Content("~/") + "season/" + databaseSeason.SeasonId; return(Ok(season)); }