private static void HydrateModelWithCommonProperties(SpecialFeatureMappingViewModel model, IDataContext context, ProgrammeFilter programmeFilter) { model.Programmes = context.Vehicle.ListProgrammes(programmeFilter); model.Gateways = model.Programmes.ListGateways(); model.CarLines = model.Programmes.ListCarLines(); model.ModelYears = model.Programmes.ListModelYears(); }
private static SpecialFeatureMappingViewModel GetFullAndPartialViewModel(IDataContext context, SpecialFeatureMappingFilter filter) { var model = new SpecialFeatureMappingViewModel(GetBaseModel(context)) { Configuration = context.ConfigurationSettings, }; HydrateModelWithCommonProperties(model, context); return model; }
private static SpecialFeatureMappingViewModel GetFullAndPartialViewModel(IDataContext context, SpecialFeatureMappingFilter filter) { var model = new SpecialFeatureMappingViewModel(GetBaseModel(context)) { Configuration = context.ConfigurationSettings, }; HydrateModelWithCommonProperties(model, context); return(model); }
private static async Task <SpecialFeatureMappingViewModel> GetFullAndPartialViewModelForFeatureMapping ( IDataContext context, SpecialFeatureMappingFilter filter ) { var baseModel = GetBaseModel(context); var model = new SpecialFeatureMappingViewModel() { PageIndex = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1, PageSize = filter.PageSize.HasValue ? filter.PageSize.Value : int.MaxValue, Configuration = context.ConfigurationSettings, CurrentUser = baseModel.CurrentUser, CurrentVersion = baseModel.CurrentVersion }; var featureMapping = await context.Vehicle.GetFdpSpecialFeatureMapping(filter); var programmeFilter = new ProgrammeFilter() { ProgrammeId = featureMapping.ProgrammeId, Gateway = featureMapping.Gateway, Code = model.SpecialFeatureMapping.Programme.VehicleName // In order to filter the gateways specific to the programme }; HydrateModelWithCommonProperties(model, context, programmeFilter); model.Gateways = context.Vehicle.ListGateways(programmeFilter); // If we are copying to another gateway, we need to remove the source gateway from the list of available gateways if (filter.Action == SpecialFeatureMappingAction.Copy) { model.Gateways = model.Gateways.Where(g => !(g.Name.Equals(featureMapping.Gateway, StringComparison.InvariantCultureIgnoreCase))); } if (!(featureMapping is EmptyFdpSpecialFeatureMapping)) { featureMapping.Programme = model.Programmes.FirstOrDefault(p => p.Id == featureMapping.ProgrammeId.GetValueOrDefault()); } model.SpecialFeatureMapping = featureMapping; return(model); }
private static async Task<SpecialFeatureMappingViewModel> GetFullAndPartialViewModelForFeatureMapping ( IDataContext context, SpecialFeatureMappingFilter filter ) { var baseModel = GetBaseModel(context); var model = new SpecialFeatureMappingViewModel() { PageIndex = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1, PageSize = filter.PageSize.HasValue ? filter.PageSize.Value : int.MaxValue, Configuration = context.ConfigurationSettings, CurrentUser = baseModel.CurrentUser, CurrentVersion = baseModel.CurrentVersion }; var featureMapping = await context.Vehicle.GetFdpSpecialFeatureMapping(filter); var programmeFilter = new ProgrammeFilter() { ProgrammeId = featureMapping.ProgrammeId, Gateway = featureMapping.Gateway, Code = model.SpecialFeatureMapping.Programme.VehicleName // In order to filter the gateways specific to the programme }; HydrateModelWithCommonProperties(model, context, programmeFilter); model.Gateways = context.Vehicle.ListGateways(programmeFilter); // If we are copying to another gateway, we need to remove the source gateway from the list of available gateways if (filter.Action == SpecialFeatureMappingAction.Copy) { model.Gateways = model.Gateways.Where(g => !(g.Name.Equals(featureMapping.Gateway, StringComparison.InvariantCultureIgnoreCase))); } if (!(featureMapping is EmptyFdpSpecialFeatureMapping)) { featureMapping.Programme = model.Programmes.FirstOrDefault(p => p.Id == featureMapping.ProgrammeId.GetValueOrDefault()); } model.SpecialFeatureMapping = featureMapping; return model; }
private static async Task <SpecialFeatureMappingViewModel> GetFullAndPartialViewModelForFeatureMappings ( IDataContext context, SpecialFeatureMappingFilter filter ) { var baseModel = GetBaseModel(context); var model = new SpecialFeatureMappingViewModel(baseModel) { PageIndex = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1, PageSize = filter.PageSize.HasValue ? filter.PageSize.Value : int.MaxValue, Configuration = context.ConfigurationSettings, CurrentUser = baseModel.CurrentUser, CurrentVersion = baseModel.CurrentVersion }; var programmeFilter = new ProgrammeFilter() { ProgrammeId = filter.ProgrammeId, Gateway = filter.Gateway }; HydrateModelWithCommonProperties(model, context, programmeFilter); model.SpecialFeatureMappings = await context.Vehicle.ListFdpSpecialFeatureMappings(filter); model.TotalPages = model.SpecialFeatureMappings.TotalPages; model.TotalRecords = model.SpecialFeatureMappings.TotalRecords; model.TotalDisplayRecords = model.SpecialFeatureMappings.TotalDisplayRecords; foreach (var featureMapping in model.SpecialFeatureMappings.CurrentPage) { featureMapping.Programme = model.Programmes.FirstOrDefault(p => p.Id == featureMapping.ProgrammeId.GetValueOrDefault()); } return(model); }
private static void HydrateModelWithCommonProperties(SpecialFeatureMappingViewModel model, IDataContext context, ProgrammeFilter programmeFilter) { model.Programmes = context.Vehicle.ListProgrammes(programmeFilter); model.Gateways = model.Programmes.ListGateways(); model.CarLines = model.Programmes.ListCarLines(); model.ModelYears = model.Programmes.ListModelYears(); }
private static void HydrateModelWithCommonProperties(SpecialFeatureMappingViewModel model, IDataContext context) { HydrateModelWithCommonProperties(model, context, new ProgrammeFilter()); }
private static async Task<SpecialFeatureMappingViewModel> GetFullAndPartialViewModelForFeatureMappings ( IDataContext context, SpecialFeatureMappingFilter filter ) { var baseModel = GetBaseModel(context); var model = new SpecialFeatureMappingViewModel(baseModel) { PageIndex = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1, PageSize = filter.PageSize.HasValue ? filter.PageSize.Value : int.MaxValue, Configuration = context.ConfigurationSettings, CurrentUser = baseModel.CurrentUser, CurrentVersion = baseModel.CurrentVersion }; var programmeFilter = new ProgrammeFilter() { ProgrammeId = filter.ProgrammeId, Gateway = filter.Gateway }; HydrateModelWithCommonProperties(model, context, programmeFilter); model.SpecialFeatureMappings = await context.Vehicle.ListFdpSpecialFeatureMappings(filter); model.TotalPages = model.SpecialFeatureMappings.TotalPages; model.TotalRecords = model.SpecialFeatureMappings.TotalRecords; model.TotalDisplayRecords = model.SpecialFeatureMappings.TotalDisplayRecords; foreach (var featureMapping in model.SpecialFeatureMappings.CurrentPage) { featureMapping.Programme = model.Programmes.FirstOrDefault(p => p.Id == featureMapping.ProgrammeId.GetValueOrDefault()); } return model; }
private static void HydrateModelWithCommonProperties(SpecialFeatureMappingViewModel model, IDataContext context) { HydrateModelWithCommonProperties(model, context, new ProgrammeFilter()); }