public static CompetitionV SetData(this CompetitionV entity, CompetitionEditorViewModel viewModel) { entity.CompetitionName = viewModel.CompetitionName; entity.CompetitionType = viewModel.CompetitionType; entity.OrganisationGuid = viewModel.OrganisationGuid; entity.Rank = viewModel.Rank; entity.WebAddress = viewModel.WebAddress; return(entity); }
public static bool GetCampaignDates(this CompetitionV competitionV, DateTime viewDate, ref DateTime startDate, ref DateTime endDate) { if (viewDate < competitionV.EffectiveFrom || viewDate > competitionV.EffectiveTo) { return(false); } var testDate = competitionV.EffectiveFrom; while (testDate < competitionV.EffectiveTo) { if (viewDate >= testDate && viewDate <= testDate.AddYears(1).AddDays(-1).ToEndOfDay()) { startDate = testDate; endDate = testDate.AddYears(1).AddDays(-1).ToEndOfDay(); return(true); } testDate = testDate.AddPeriod(competitionV.CampaignPeriodType, competitionV.CampaignPeriodValue); } return(false); }
public static BaseCompetitionViewModel ToViewModel(this CompetitionV version, DateTime viewDate) { return(version.ToViewModel <BaseCompetitionViewModel, Competition, CompetitionV>(viewDate)); }