예제 #1
0
        public IList <Book> FindBySection(BookSection section)
        {
            var xDoc      = DocumentHolder.Document;
            var root      = xDoc.DocumentElement;
            var bookNodes = root.SelectNodes("book[section='" + section + "']");

            return(Parser.ParseNodes(bookNodes));
        }
예제 #2
0
 public Book(int id, string title, float rating, BookSection section, string description)
 {
     _id          = id;
     _title       = title;
     _rating      = rating;
     _section     = section;
     _description = description;
 }
예제 #3
0
        private void Section_Selection_Changed(object sender, RoutedEventArgs args)
        {
            ComboBox    box     = (ComboBox)sender;
            BookSection section = BookUtils.ParseSection(box.SelectedValue.ToString());

            BookDtoConverter dtoConverter = new BookDtoConverter
            {
                BookCounter  = BookCounter,
                BookArranger = BookArranger
            };

            allBooksBySection.ItemsSource = dtoConverter.ConvertBooks(BookService.FindBySection(section));
            allBooksBySection.Items.Refresh();
        }
예제 #4
0
        public IHttpActionResult CreatBookInfo(CreatBooKinfoDTO obj)
        {
            BookSection res = new BookSection();

            res.BookID         = obj.BooklD;
            res.SectionOrder   = obj.SectionOrder;
            res.SectionContent = obj.SectionContent;

            res.AddTime = DateTime.Now;
            res.Remark  = obj.Remark;
            YL.BookSection.Add(res);
            YL.SaveChanges();
            return(Content(HttpStatusCode.OK, new resultInfo {
                Code = 200, Message = "OK", Data = res
            }));
        }
예제 #5
0
        public BookProxy(Book book)
        {
            Id          = book.Id;
            Title       = book.Title;
            Rating      = book.Rating;
            Section     = book.Section;
            Description = book.Description;

            _oldTitle       = Title;
            _oldRating      = Rating;
            _oldDescription = Description;
            _oldSection     = Section;

            if (book is BookProxy proxy && proxy._authorsAreFetchedOrSet)
            {
                base.Authors            = proxy.Authors;
                _authorsAreFetchedOrSet = true;
            }
예제 #6
0
        public int Post(BookSectionModel bookSectionModel)
        {
            int success = 0;

            using (var db = new BookDbContext())
            {
                var bookSection = new BookSection()
                {
                    ChapterId       = bookSectionModel.ChapterId,
                    SectionTitle    = bookSectionModel.SectionTitle,
                    SectionOrder    = bookSectionModel.SectionOrder,
                    SectionContents = bookSectionModel.SectionContents
                };
                db.Sections.Add(bookSection);
                db.SaveChanges();
                success = bookSection.Id;
            }
            return(success);
        }
예제 #7
0
        public BookSectionModel Patch(int sectionId)
        {
            var sectionModel = new BookSectionModel();

            using (var db = new BookDbContext())
            {
                BookSection dbSection = db.Sections.Where(s => s.Id == sectionId).FirstOrDefault();
                if (dbSection != null)
                {
                    sectionModel.Id              = dbSection.Id;
                    sectionModel.ChapterOrder    = dbSection.Chapter.ChapterOrder;
                    sectionModel.ChapterTitle    = dbSection.Chapter.ChapterTitle;
                    sectionModel.SectionTitle    = dbSection.SectionTitle;
                    sectionModel.SectionOrder    = dbSection.SectionOrder;
                    sectionModel.SectionContents = dbSection.SectionContents;
                    sectionModel.success         = "ok";
                }
            }
            return(sectionModel);
        }