private static SaveLayoutModel MapPageModel(GetLayoutResponse response) { var model = new SaveLayoutModel { Version = response.Data.Version, Name = response.Data.Name, LayoutPath = response.Data.LayoutPath, PreviewUrl = response.Data.PreviewUrl, Options = response.Options, }; if (response.Regions != null) { model.Regions = response .Regions .Select(r => new RegionSaveModel { RegionIdentifier = r.RegionIdentifier, Description = r.Description }) .ToList(); } return(model); }
public GetLayoutResponse Get(GetLayoutRequest request) { var model = repository .AsQueryable<Module.Root.Models.Layout>(layout => layout.Id == request.LayoutId) .Select(layout => new LayoutModel { Id = layout.Id, Version = layout.Version, CreatedBy = layout.CreatedByUser, CreatedOn = layout.CreatedOn, LastModifiedBy = layout.ModifiedByUser, LastModifiedOn = layout.ModifiedOn, Name = layout.Name, LayoutPath = layout.LayoutPath, PreviewUrl = layout.PreviewUrl }) .FirstOne(); var response = new GetLayoutResponse { Data = model }; if (request.Data.IncludeOptions) { response.Options = LayoutServiceHelper.GetLayoutOptionsList(repository, request.LayoutId); } if (request.Data.IncludeRegions) { response.Regions = LayoutServiceHelper.GetLayoutRegionsList(repository, request.LayoutId); } return response; }
private static SaveLayoutModel MapPageModel(GetLayoutResponse response) { var model = new SaveLayoutModel { Version = response.Data.Version, Name = response.Data.Name, LayoutPath = response.Data.LayoutPath, PreviewUrl = response.Data.PreviewUrl, Options = response.Options, }; if (response.Regions != null) { model.Regions = response .Regions .Select(r => new RegionSaveModel { RegionIdentifier = r.RegionIdentifier, Description = r.Description }) .ToList(); } return model; }
public static PostLayoutRequest ToPostRequest(this GetLayoutResponse response) { var model = MapPageModel(response); return(new PostLayoutRequest { Data = model }); }
public static PutLayoutRequest ToPutRequest(this GetLayoutResponse response) { var model = MapPageModel(response); return(new PutLayoutRequest { Data = model, Id = response.Data.Id }); }