public EditViewData(Models.FundingEvent fundingEvent, List <FundingSourceSimple> allFundingSources, List <FundingEventType> allFundingEventTypes) { AllFundingSources = allFundingSources; TreatmentBMPID = fundingEvent.TreatmentBMPID; AllFundingEventTypes = allFundingEventTypes.ToSelectListWithDisabledEmptyFirstRow( x => x.FundingEventTypeID.ToString(CultureInfo.InvariantCulture), x => x.FundingEventTypeDisplayName, "Select a Funding Event Type"); }
public void UpdateModel(Models.FundingEvent currentFundingEvent, IList <Models.FundingEventFundingSource> allFundingEventFundingSources) { currentFundingEvent.Description = FundingEvent.Description; currentFundingEvent.FundingEventTypeID = FundingEvent.FundingEventTypeID; currentFundingEvent.Year = FundingEvent.Year; var fundingEventFundingSourcesToUpdate = FundingEvent?.FundingEventFundingSources?.Select(x => x.ToFundingEventFundingSource()).ToList() ?? new List <FundingEventFundingSource>(); currentFundingEvent.FundingEventFundingSources.Merge(fundingEventFundingSourcesToUpdate, allFundingEventFundingSources, (z, w) => z.FundingEventID == w.FundingEventID && z.FundingSourceID == w.FundingSourceID, (z, w) => z.Amount = w.Amount); }
public EditViewModel(Models.FundingEvent fundingEvent) { FundingEvent = new FundingEventSimple(fundingEvent); }