Beispiel #1
0
        public async Task <ApiResponseAsync <bool> > CreatePageContent(CreateContentDTO dto)
        {
            await this._body.Create(dto.NotesId, dto.SectionId, dto.PageId, dto.Cotnent);


            return(ApiRes.OK(true));
        }
Beispiel #2
0
        public async Task <ApiResponseAsync <bool> > DelNotes(ObjDTO dto)
        {
            var notes = await this._notes.DelNotes(dto.Id);

            await this._userRoot.CatalogItemSubstructAsync(this._appUser.UserId, notes.Notes.CalelogCode, notes.Notes.GradeCode);


            if (notes.HasSection() == false)
            {
                return(ApiRes.OK(true));
            }

            List <Guid> pageAryId = new List <Guid>();

            foreach (var item in notes.Sections)
            {
                if (item.HasPages() == false)
                {
                    continue;
                }
                pageAryId.AddRange(item.Pages.Select(p => p.Page.Id));
            }



            if (pageAryId.Count > 0)
            {
                await this._body.Del(pageAryId.ToArray());

                await this._userRoot.DelSection(this._appUser.UserId, pageAryId.ToArray());
            }

            return(ApiRes.OK(true));
            //throw new NotImplementedException();
        }
Beispiel #3
0
        public async Task <ApiResponseAsync <Guid> > CreateSection(UpdatePropDTO dto)
        {
            var id = Guid.NewGuid();

            var rev = await this._notes.CreateSection(dto.Id, id, dto.Body);

            return(ApiRes.OK(id));
        }
Beispiel #4
0
        public async Task <ApiResponseAsync <bool> > DelSection(ObjDTO dto)
        {
            var rev = await this._notes.DelSection(dto.Id, dto.SectionId);

            await this._body.Del(rev?.ToArray());

            await this._userRoot.DelSection(this._appUser.UserId, dto.SectionId);

            return(ApiRes.OK(true));
        }
Beispiel #5
0
        public async Task <ApiResponseAsync <Guid> > CreatePage(CreatePageDTO dto)
        {
            Guid pId = Guid.NewGuid();

            var rev = await this._notes.CreatePage(dto.NotesId, dto.Id, pId, dto.Body, "");

            await this._body.Create(dto.NotesId, dto.Id, pId, "");


            return(ApiRes.OK(rev.CurrentSection.CurrentPage.Page.Id));
        }
Beispiel #6
0
        public async Task <ApiResponseAsync <bool> > DelPage(ObjDTO dto)
        {
            var rev = await this._notes.DelPage(dto.Id, dto.SectionId, dto.PageId);

            await this._userRoot.DelPageAsync(this._appUser.UserId, dto.SectionId, dto.PageId);

            return(ApiRes.OK(rev));



            //var ret = this._notes.DelSection(dto.Id, dto.SectionId);
        }
Beispiel #7
0
        public async Task <ApiResponseAsync <NotesVO> > Get(string id)
        {
            var sh = new StringHelper(id).Split(',');

            var nid = sh.As <Guid>(0);

            var pid = sh.As <Guid>(2);

            var nv = await this._qs.Get(nid, sh.As <Guid>(1), pid);

            var content = await this._body.Get(pid);

            nv.Body = content;

            return(ApiRes.OK(nv));
        }
Beispiel #8
0
        public async Task <ApiResponseAsync <Guid> > CreateNotes(CreateNotesDTO dto)
        {
            if (dto.Section != null)
            {
                dto.Section.Id = Guid.NewGuid();
            }

            if (dto.Page != null)
            {
                dto.Page.Id = Guid.NewGuid();
            }

            if (String.IsNullOrEmpty(dto.ClassId))
            {
                //dto.ClassId = await this._appUser.ClassIdAsync();
            }

            var ret = await this._notes.CreateAsync(dto, Guid.NewGuid(), this._appUser.UserName, this._appUser.UserId);

            await this._userRoot.ReferenceCatalog(this._appUser.UserId, dto.CatalogCode, dto.CatalogName, dto.GradeCode, dto.GradeName);


            return(ApiRes.OK(ret.Notes.Id));
        }