public async Task <InfoModel <TableOutputReportInfo> > GetListPageLikeName([FromForm] string name) { var list = await ContentContext.GetListPageLikeName( HttpContext.RequestServices, new PageInfo(0, 10000), name); return(new InfoModel <TableOutputReportInfo>() { Data = new TableOutputReportInfo() { ReportList = list.ConvertAll(T => { return new OutPutContentInfoItem() { Introduce = T.GetEntity().Introduce, Content = T.GetEntity().Content.HtmlDecode(), ContentId = T.GetKey(), CreateTiem = T.GetEntity().CreateDate.ToString("yyyy-MM-dd hh:mm:ss"), HeadImage = new TempFileInfo() { ServerDirPath = T.GetDownFileDir(), ServerFileName = T.GetEntity().Image, }, Title = T.GetEntity().Title, }; }), }, }); }
public IActionResult GetData([FromQuery] int itemIndex = -1) { var contentPath = Field.Name; if (Field.IsListValue) { if (itemIndex < 0) { return(BadRequest()); } contentPath += $"[{itemIndex}]"; } var contentContext = ContentContext.Navigate(contentPath); if (contentContext == null) { return(NotFound()); } var contentExplorer = contentContext.Explorer; var result = new ContentItem { Title = contentExplorer.Title, Type = new ContentItemType { Name = contentExplorer.Metadata.Name, Title = contentExplorer.Metadata.Title } }; return(Ok(result)); }
public async Task <InfoModelList <OutPutContentInfoItem> > GetListAsync([FromBody] PageInfo pageInfo) { var list = await ContentContext.GetListPageWithStatus( HttpContext.RequestServices, pageInfo, Macro.TASK_COMPLETE); return(new InfoModelList <OutPutContentInfoItem>() { ListData = list.ConvertAll(T => { return new OutPutContentInfoItem() { Introduce = T.GetEntity().Introduce, Content = T.GetEntity().Content.HtmlDecode(), ContentId = T.GetKey(), CreateTiem = T.GetEntity().CreateDate.ToString("yyyy-MM-dd hh:mm:ss"), HeadImage = new TempFileInfo() { ServerDirPath = T.GetDownFileDir(), ServerFileName = T.GetEntity().Image, }, Title = T.GetEntity().Title }; }), PageInfo = pageInfo }); }
public override object VisitContent([NotNull] ContentContext context) { return(new Text(new List <Flag>(), new List <Argument> { new Argument(null, context.GetText()) })); }
public XElement Serialize() { var result = new XElement(Constants.XMLNamespaces.EHEALTHBOX_PUBLICATION + "SendMessageRequest", new XAttribute("xmlns", Constants.XMLNamespaces.EHEALTHBOX_PUBLICATION)); if (BoxId != null) { result.Add(BoxId.Serialize()); } foreach (var contextType in DestinationContextLst) { result.Add(contextType.Serialize()); } result.Add(ContentContext.Serialize()); foreach (var copyMailTo in CopyMailToLst) { result.Add(new XElement("CopyMailTo", copyMailTo)); } if (!string.IsNullOrWhiteSpace(PublicationId)) { result.Add(new XAttribute("PublicationId", PublicationId)); } return(result); }
protected override async Task RenderContentAsync(TagHelperOutput output) { output.TagMode = TagMode.StartTagAndEndTag; if (Field.IsListValue) { var list = Field.GetModelValue(Content) as IList; if (Field.HasValue(list)) { for (var i = 0; i < list.Count; i++) { var itemContentContext = ContentContext.Navigate($"{FieldName.Name}[{i}]"); var itemHtml = await viewRenderService.RenderToStringAsync(itemContentContext); output.Content.AppendHtmlLine(itemHtml); } } } else { var value = Field.GetModelValue(Content); if (Field.HasValue(value)) { var itemContentContext = ContentContext.Navigate(FieldName.Name); var itemHtml = await viewRenderService.RenderToStringAsync(itemContentContext); output.Content.AppendHtmlLine(itemHtml); } } }
public async Task <IActionResult> ViewAsync([FromServices] IViewRenderService viewRenderService, [FromQuery] int itemIndex = -1) { var contentPath = Field.Name; if (Field.IsListValue) { if (itemIndex < 0) { return(BadRequest()); } contentPath += $"[{itemIndex}]"; } var contentContext = ContentContext.Navigate(contentPath); if (contentContext == null) { return(NotFound()); } var html = await viewRenderService.RenderToStringAsync(contentContext); return(new ContentResult { ContentType = "text/html", StatusCode = 200, Content = html }); }
async Task IAsyncActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { pageService = HttpContext.RequestServices.GetRequiredService <IPageService>(); pageEditingService = HttpContext.RequestServices.GetRequiredService <IPageContentService>(); if (!Request.Query.TryGetValue("editId", out Microsoft.Extensions.Primitives.StringValues editIdValue) || !Guid.TryParse(editIdValue[0], out Guid editId)) { context.Result = BadRequest(); return; } editSession = await pageEditingService.FindEditByIdAsync(editId, HttpContext.RequestAborted); if (editSession == null) { context.Result = BadRequest(); return; } page = await pageService.FindPageByIdAsync(editSession.PageId); if (page == null) { context.Result = BadRequest(); return; } var content = await pageEditingService.GetContentAsync(editSession, HttpContext.RequestAborted); rootContentContext = new ContentContext(page, content, HttpContext.RequestServices, true); string modelPath = string.Empty; if (Request.Query.TryGetValue("path", out Microsoft.Extensions.Primitives.StringValues pathValue)) { modelPath = pathValue[0]; } contentContext = rootContentContext.Navigate(modelPath); if (contentContext == null) { context.Result = BadRequest(); return; } if (!Request.Query.TryGetValue("field", out Microsoft.Extensions.Primitives.StringValues fieldNameValue)) { context.Result = BadRequest(); return; } string fieldName = fieldNameValue[0]; if (!contentContext.Explorer.Metadata.TryGetField(fieldName, out field)) { context.Result = BadRequest(); return; } await next(); }
public bool AddView(ViewEntity addView) { using (var context = new ContentContext()) { context.ViewEntity.Add(addView); return(context.SaveChanges() > 0); } }
internal static void EndEditableArea(ViewContext viewContext) { if (viewContext.InEditMode()) { ContentContext.PopCurrentProperty(viewContext.RequestContext); viewContext.Writer.Write("</div>"); } }
public void Subscribe(User follower, User followee) { ContentContext.DbSet <Subscription>().Add(new Subscription { Follower = follower, Followee = followee }); ContentContext.SaveChanges(); }
public ContentContext content() { ContentContext _localctx = new ContentContext(_ctx, State); EnterRule(_localctx, 2, RULE_content); int _la; try { int _alt; EnterOuterAlt(_localctx, 1); { State = 17; _la = _input.La(1); if (_la == SEA_WS || _la == TEXT) { { State = 16; chardata(); } } State = 25; _errHandler.Sync(this); _alt = Interpreter.AdaptivePredict(_input, 2, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { { { State = 19; element(); State = 21; _la = _input.La(1); if (_la == SEA_WS || _la == TEXT) { { State = 20; chardata(); } } } } } State = 27; _errHandler.Sync(this); _alt = Interpreter.AdaptivePredict(_input, 2, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.ReportError(this, re); _errHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
public bool UpdateView(ViewEntity updateView) { using (var context = new ContentContext()) { context.ViewEntity.Attach(updateView); context.Entry(updateView).State = EntityState.Modified; return(context.SaveChanges() > 0); } }
public void CreateMessage(User user, string text, IDateTimeHelper dateTime) { ContentContext.DbSet <Message>().Add(new Message { Text = text, CreatedBy = user, CreatedDate = dateTime.CurrentDateTime }); ContentContext.SaveChanges(); }
public UploadAudioCommandHandler(ContentContext db, ICloudStorageService cloudStorageservice) { _db = db; _cloudStorageService = cloudStorageservice; _mapperConfiguration = new MapperConfiguration(cfg => { cfg.AddProfile <ContentDAOProfile>(); }); }
public User CreateUser(string name) { var user = new User { Name = name }; ContentContext.DbSet <User>().Add(user); ContentContext.SaveChanges(); return(user); }
public async Task <InfoModel <bool> > DeleteContent([FromForm] string id) { var info = await ContentContext.GetInfo(HttpContext.RequestServices, id); info.Ver(); await info.MoveToRecycle(); return(new InfoModel <bool>() { Data = true }); }
public async Task <InfoModel <bool> > ExaContent([FromForm] string id, [FromForm] int status) { var info = await ContentContext.GetInfo(HttpContext.RequestServices, id); info.Ver(); await info.UpdateWithStatus((short)status); return(new InfoModel <bool>() { Data = true }); }
//-------------------------------------- //-------------------------------------- public ContentTransfer NodeCreate(ContentTransfer nodeNew) { Node nodeDb = ContentXferToDbNode(nodeNew); using (ContentContext db = new ContentContext()) { db.Nodes.Add(nodeDb); db.SaveChanges(); } return NodeGetByPath(nodeNew.Path); }
public FindByProfileIdQueryHandler(ContentContext db, IMediator mediator) { _db = db; _mediator = mediator; _mapperConfiguration = new MapperConfiguration(cfg => { cfg.AddProfile <ContentProfile>(); cfg.CreateMap <ContentDAO, FindByProfileIdResult>() .ForMember(m => m.ContentDetails, opt => opt.MapFrom(src => src)) .ForMember(m => m.State, opt => opt.MapFrom(src => src)) .ForMember(m => m.Manifest, opt => opt.MapFrom(src => src)); }); }
public UpdateMediaCommandHandler(ContentContext db, IMediator mediator) { _db = db; _mediator = mediator; _mapperConfiguration = new MapperConfiguration(cfg => { cfg.AddProfile <ContentDAOProfile>(); cfg.CreateMap <FindByIdResult, Model.Media>() .ForMember(m => m.ContentDetails, opt => opt.MapFrom(src => src.ContentDetails)) .ForMember(m => m.State, opt => opt.MapFrom(src => src.State)) .ForMember(m => m.Manifest, opt => opt.MapFrom(src => src.Manifest)); }); }
public static List <ContentModel> GetContent() { List <ContentModel> contentModelList = new List <ContentModel>(); using (var context = new ContentContext()) { var contentModel = from temp in context.Contents select temp; contentModelList = contentModel.ToList(); } return(contentModelList); }
public GetMediaByArrayOfIdsQueryHandler(ContentContext db) { _db = db; _mapperConfiguration = new MapperConfiguration(cfg => { cfg.AddProfile <ContentProfile>(); cfg.CreateMap <ContentDAO, GetMediaByArrayOfIdsResult>() .ForMember(m => m.ContentDetails, opt => opt.MapFrom(src => src)) .ForMember(m => m.State, opt => opt.MapFrom(src => src)) .ForMember(m => m.Manifest, opt => opt.MapFrom(src => src)); }); }
//-------------------------------------- //-------------------------------------- //public void NodeDelete(int id) //{ //} //-------------------------------------- //-------------------------------------- public bool NodeExistsTest(string path) { bool result = false; using (ContentContext db = new ContentContext()) { int count = db.Nodes.Where(n => n.Path == path).Count(); if (count > 0) result = true; } return result; }
public void Init(IValueProvider valueProvider) { var curContent = styleContext.htmlContent(); var stream = curContent.GetStream(); File = new ParseFile().ToParse(IO.Path.GetRandomFileName(), stream, FileType.Css); File.IsInternal = true; ContentContext content = new ContentContext(styleContext, File); styleContext.Replace(curContent, content); valueProvider.AddFile(File); }
//-------------------------------------- //-------------------------------------- public ContentTransfer NodeGetByPath(string path) { ContentTransfer nodeXfer = null; using (ContentContext db = new ContentContext()) { Node nodeDb = db.Nodes.Where(n => n.Path == path).Single(); if (nodeDb != null) nodeXfer = DbNodeToContentXfer(nodeDb); } return nodeXfer; }
//-------------------------------------- //-------------------------------------- public ContentTransfer NodeGetById(int id) { ContentTransfer nodeXfer = null; using (ContentContext db = new ContentContext()) { Node nodeDb = db.Nodes.Where(n => n.Id == id).Single(); if (nodeDb != null) nodeXfer = DbNodeToContentXfer(nodeDb); } return nodeXfer; }
private ItemRepository GetInMemoryCategoryRepository(List <Item> items) { DbContextOptions <ContentContext> options; var builder = new DbContextOptionsBuilder <ContentContext>(); builder.UseInMemoryDatabase("testDb"); options = builder.Options; ContentContext contentContext = new ContentContext(options); contentContext.Database.EnsureDeleted(); contentContext.Database.EnsureCreated(); contentContext.Items.AddRange(items); contentContext.SaveChanges(); return(new ItemRepository(contentContext, mapper.Object)); }
public async Task <InfoModel <OutPutContentInfoItem> > GetInfo([FromForm] string Id) { var T = await ContentContext.GetInfo(HttpContext.RequestServices, Id); T.Ver(); var list = await CommContext.GetListPageWithContentID( HttpContext.RequestServices, new PageInfo(0, 1000), Id ); return(new InfoModel <OutPutContentInfoItem>() { Data = new OutPutContentInfoItem() { Content = T.GetEntity().Content.HtmlDecode(), ContentId = T.GetKey(), CreateTiem = T.GetEntity().CreateDate.ToString("yyyy-MM-dd hh:mm:ss"), HeadImage = new TempFileInfo() { ServerDirPath = T.GetDownFileDir(), ServerFileName = T.GetEntity().Image, }, Title = T.GetEntity().Title, Status = T.GetEntity().Status, Introduce = T.GetEntity().Introduce, ExamineList = HttpContext.RequestServices.GetDataTypeForConstant <ContentStatusType>().DataType.ConvertAll(T => { return new TypeForName <int, string>() { Id = T.Id, Name = T.Value }; }), CommList = (await Task.WhenAll(list.ConvertAll(async K => { return new Comminfo() { Content = K.GetEntity().Content, DateTime = K.GetEntity().CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), Name = await K.GetCreateName() }; }))).ToList() } }); }
//-------------------------------------- //-------------------------------------- public List<ContentTransfer> NodeChildrenGet(int id) { List<ContentTransfer> children = new List<ContentTransfer>(); using (ContentContext db = new ContentContext()) { List<Node> childNodes = db.Nodes.Where(n => n.ParentId == id).ToList<Node>(); foreach (Node nodeDb in childNodes) { ContentTransfer nodeXfer = DbNodeToContentXfer(nodeDb); children.Add(nodeXfer); } } return children; }
public void AddContent(ContentContext.ContentElement contentElement) { _content.Add(contentElement); }