public IHttpActionResult UpdateBookType(UpdateBookTypeDTO obj) { var cc = YL.BookType.Where(a => a.ID == obj.ID).FirstOrDefault(); cc.TypeName = obj.TypeName; YL.SaveChanges(); return(Content(HttpStatusCode.OK, CodeNew.Successful("更新图书类型成功", cc))); }
public IHttpActionResult CreatBookType(CreatBookTypeDTO obj) { // var cc= YL.BookList.Where(a=>a.) BookType res = new BookType(); res.TypeName = obj.TypeName; res.AddTime = DateTime.Now; YL.BookType.Add(res); YL.SaveChanges(); return(Content(HttpStatusCode.OK, CodeNew.Successful("新加图书类型成功", res))); }
public IHttpActionResult GetBookList(int BookID) { var cc = YL.BookList.Include("SubBookSection").Where(a => a.BookID == BookID).Select(a => new { a.Title, a.Abstract, a.Author, a.AddTime, a.BookType, a.State, a.Recommend, a.ClickNum, a.Remark, BookSectionCount = a.BookSection.Count }).ToList(); return(Content(HttpStatusCode.OK, CodeNew.Successful("查看图书类型成功", cc))); }
public IHttpActionResult CreatBookList(CreaTBookListDTO obj) { BookList res = new BookList(); res.Title = obj.Title; res.Abstract = obj.Abstract; res.Author = obj.Author; res.AddTime = DateTime.Now; res.BookType = obj.BookType; res.State = obj.State; res.TopTime = obj.TopTime; res.Recommend = obj.Recommend; res.Remark = obj.Remark; res.ClickNum = 0; res.CoverIMG = obj.CoverIMG; YL.BookList.Add(res); YL.SaveChanges(); return(Content(HttpStatusCode.OK, CodeNew.Successful("图书新加目录成功", res))); }
public IHttpActionResult UpdateBookList(UpdateBookListDTO obj) { var res = YL.BookList.Where(a => a.BookID == obj.BookID).FirstOrDefault(); // BookList res = new BookList(); res.Title = obj.Title; res.Abstract = obj.Abstract; res.Author = obj.Author; res.AddTime = DateTime.Now; res.BookType = obj.BookType; res.State = obj.State; res.TopTime = obj.TopTime; res.Recommend = obj.Recommend; res.Remark = obj.Remark; // res.ClickNum = 0; res.CoverIMG = obj.CoverIMG; YL.SaveChanges(); return(Content(HttpStatusCode.OK, CodeNew.Successful("更新目录成功", res))); }
public IHttpActionResult GetBookType() { var cc = YL.BookType.ToList(); return(Content(HttpStatusCode.OK, CodeNew.Successful("查看图书类型成功", cc))); }