Ejemplo n.º 1
0
        public ActionResult Chapters_Destroy([DataSourceRequest]DataSourceRequest request, ChapterAdminViewModel chapter)
        {
            if (this.ModelState.IsValid)
            {
                var entity = new Chapter
                {
                    Id = chapter.Id,
                    IsDeleted = true
                };

                this.chapterService.Update(entity);
            }

            return this.Json(new[] { chapter }.ToDataSourceResult(request, this.ModelState));
        }
Ejemplo n.º 2
0
        public ActionResult Chapters_Update([DataSourceRequest]DataSourceRequest request, ChapterAdminViewModel chapter)
        {
            if (this.ModelState.IsValid)
            {
                var entity = new Chapter
                {
                    Id = chapter.Id,
                    Title = chapter.Title,
                    ModifiedOn = DateTime.Now,
                    Content = chapter.Content,
                    StoryId = chapter.StoryId,
                    PreviousChapterId = chapter.PreviousChapterId,
                    AuthorId = chapter.AuthorId,
                };

                this.chapterService.Update(entity);
            }

            return this.Json(new[] { chapter }.ToDataSourceResult(request, this.ModelState));
        }