// GET: TaskAllocation public ActionResult Index(BookTaskModel model, PagingFilteringModel command) { PrepareBookModel(model); var request = new BookWorkRequest() { Name = model.Name, Begin = model.Begin, DegreeId = model.DegreeId, End = model.End, GradeId = model.GradeId, Isbn = model.Isbn, PublisherId = model.PublisherId, SubjectId = model.SubjectId, TermId = model.TermId, Year = model.Year, PageIndex = command.PageIndex, PageSize = 10 }; var pageData = _bookWorkTaskService.GetBookWorkList(request); model.BookWorkTaskList = pageData; model.PagingFilteringModel.LoadPagedList(pageData); return(View(model)); }
/// <summary> /// Deletes the book. /// </summary> /// <param name="book">The book.</param> /// <exception cref="ArgumentNullException">book</exception> public void DeleteBook(Book book) { if (book == null) { throw new ArgumentNullException(nameof(book)); } _bookRepository.Delete(book); //删除书本的同时删除任务 var taskList = _bookWorkTaskService.GetBookWorkList(new BookWorkRequest() { BookId = book.Id }); taskList?.ForEach(t => _bookWorkTaskService.DeleteBookWorkTask(t)); //删除书本目录节点 var itemList = _bookWorkTaskItemService.GetBookWorkTaskItemsByBookId(book.Id); _bookWorkTaskItemService.DeleteBookWorkTaskItems(itemList); //删除书本关联的 题目 var bookTiMuList = _tiMuService.GetBookTiMuList(book.Id); _tiMuService.DeleteTiMu(bookTiMuList?.Select(t => t.Timu).ToArray()); _tiMuService.DeleteBookTiMu(bookTiMuList?.ToArray()); }