public GetServerControlWidgetResponse Get(GetServerControlWidgetRequest request) { var model = repository .AsQueryable <Module.Pages.Models.ServerControlWidget>(widget => widget.Id == request.WidgetId) .Select(widget => new ServerControlWidgetModel { Id = widget.Id, Version = widget.Version, CreatedBy = widget.CreatedByUser, CreatedOn = widget.CreatedOn, LastModifiedBy = widget.ModifiedByUser, LastModifiedOn = widget.ModifiedOn, Name = widget.Name, IsPublished = widget.Status == ContentStatus.Published, PublishedOn = widget.Status == ContentStatus.Published ? widget.PublishedOn : null, PublishedByUser = widget.Status == ContentStatus.Published ? widget.PublishedByUser : null, CategoryId = widget.Category != null && !widget.Category.IsDeleted ? widget.Category.Id : (Guid?)null, CategoryName = widget.Category != null && !widget.Category.IsDeleted ? widget.Category.Name : null, WidgetUrl = widget.Url, PreviewUrl = widget.PreviewUrl }) .FirstOne(); var response = new GetServerControlWidgetResponse { Data = model }; if (request.Data.IncludeOptions) { response.Options = WidgetOptionsHelper.GetWidgetOptionsList(repository, request.WidgetId); } return(response); }
public GetServerControlWidgetResponse Get(GetServerControlWidgetRequest request) { var model = repository .AsQueryable <Module.Pages.Models.ServerControlWidget>(widget => widget.Id == request.WidgetId) .Select(widget => new ServerControlWidgetModel { Id = widget.Id, Version = widget.Version, CreatedBy = widget.CreatedByUser, CreatedOn = widget.CreatedOn, LastModifiedBy = widget.ModifiedByUser, LastModifiedOn = widget.ModifiedOn, Name = widget.Name, IsPublished = widget.Status == ContentStatus.Published, PublishedOn = widget.Status == ContentStatus.Published ? widget.PublishedOn : null, PublishedByUser = widget.Status == ContentStatus.Published ? widget.PublishedByUser : null, WidgetUrl = widget.Url, PreviewUrl = widget.PreviewUrl }) .FirstOne(); var response = new GetServerControlWidgetResponse { Data = model }; if (request.Data.IncludeOptions) { response.Options = WidgetOptionsHelper.GetWidgetOptionsList(repository, request.WidgetId); } if (request.Data.IncludeCategories) { response.Categories = (from pagePr in repository.AsQueryable <Module.Root.Models.Widget>() from category in pagePr.Categories where pagePr.Id == request.WidgetId && !category.IsDeleted select new CategoryModel { Id = category.Category.Id, Version = category.Version, CreatedBy = category.CreatedByUser, CreatedOn = category.CreatedOn, LastModifiedBy = category.ModifiedByUser, LastModifiedOn = category.ModifiedOn, Name = category.Category.Name }).ToList(); } return(response); }
public GetHtmlContentWidgetResponse Get(GetHtmlContentWidgetRequest request) { var model = repository .AsQueryable <Module.Pages.Models.HtmlContentWidget>(widget => widget.Id == request.WidgetId) .Select(widget => new HtmlContentWidgetModel { Id = widget.Id, Version = widget.Version, CreatedBy = widget.CreatedByUser, CreatedOn = widget.CreatedOn, LastModifiedBy = widget.ModifiedByUser, LastModifiedOn = widget.ModifiedOn, Name = widget.Name, IsPublished = widget.Status == ContentStatus.Published, PublishedOn = widget.Status == ContentStatus.Published ? widget.PublishedOn : null, PublishedByUser = widget.Status == ContentStatus.Published ? widget.PublishedByUser : null, CategoryId = widget.Category != null && !widget.Category.IsDeleted ? widget.Category.Id : (Guid?)null, CategoryName = widget.Category != null && !widget.Category.IsDeleted ? widget.Category.Name : null, CustomCss = widget.CustomCss, UseCustomCss = widget.UseCustomCss, Html = widget.Html, UseHtml = widget.UseHtml, CustomJavaScript = widget.CustomJs, UseCustomJavaScript = widget.UseCustomJs }) .FirstOne(); var response = new GetHtmlContentWidgetResponse { Data = model }; if (request.Data.IncludeOptions) { response.Options = WidgetOptionsHelper.GetWidgetOptionsList(repository, request.WidgetId); } if (request.Data.IncludeChildContentsOptions) { response.ChildContentsOptionValues = optionService .GetChildContentsOptionValues(request.WidgetId) .ToServiceModel(); } return(response); }
public GetHtmlContentWidgetResponse Get(GetHtmlContentWidgetRequest request) { var model = repository .AsQueryable <Module.Pages.Models.HtmlContentWidget>(widget => widget.Id == request.WidgetId) .Select(widget => new HtmlContentWidgetModel { Id = widget.Id, Version = widget.Version, CreatedBy = widget.CreatedByUser, CreatedOn = widget.CreatedOn, LastModifiedBy = widget.ModifiedByUser, LastModifiedOn = widget.ModifiedOn, Name = widget.Name, IsPublished = widget.Status == ContentStatus.Published, PublishedOn = widget.Status == ContentStatus.Published ? widget.PublishedOn : null, PublishedByUser = widget.Status == ContentStatus.Published ? widget.PublishedByUser : null, CustomCss = widget.CustomCss, UseCustomCss = widget.UseCustomCss, Html = widget.Html, UseHtml = widget.UseHtml, CustomJavaScript = widget.CustomJs, UseCustomJavaScript = widget.UseCustomJs }) .FirstOne(); var response = new GetHtmlContentWidgetResponse { Data = model }; if (request.Data.IncludeOptions) { response.Options = WidgetOptionsHelper.GetWidgetOptionsList(repository, request.WidgetId); } if (request.Data.IncludeChildContentsOptions) { response.ChildContentsOptionValues = optionService .GetChildContentsOptionValues(request.WidgetId) .ToMultilingualServiceModel(); } if (request.Data.IncludeCategories) { response.Categories = (from pagePr in repository.AsQueryable <Module.Root.Models.Widget>() from category in pagePr.Categories where pagePr.Id == request.WidgetId && !category.IsDeleted select new CategoryModel { Id = category.Category.Id, Version = category.Version, CreatedBy = category.CreatedByUser, CreatedOn = category.CreatedOn, LastModifiedBy = category.ModifiedByUser, LastModifiedOn = category.ModifiedOn, Name = category.Category.Name }).ToList(); } return(response); }