//gets the details of the particular book in the wishlist public WishListStatus getBookDetails(int wishListID) { WishListStatus a = new WishListStatus(); try { using (var dbcontext = new Orchard9Entities()) { var query = (from e in dbcontext.tblWishlists join d in dbcontext.tblBooks on e.ISBN equals d.ISBN join x in dbcontext.tblUsers on e.UserId equals x.UserId where e.id == wishListID select new WishListModel() { id = e.id, ISBN = e.ISBN, UserId = e.UserId, price = d.Price, Publisher = d.Publisher, Author = d.Author, rating = d.Rating, BookName = d.BookName, BookImageUrl = d.BookImageUrl }).ToList(); a.statusList = query; if (query.Count > 0) { a.statusMessage = "book details"; } else { a.statusMessage = "book not available"; } } } catch (Exception e) { a.statusMessage = e.Message; } return(a); }
//displays all the books in the wishlist public WishListStatus displayAllItems(int userid) { WishListStatus w = new WishListStatus(); try { using (var dbcontext = new Orchard9Entities()) { if ((from e in dbcontext.tblUsers where e.UserId == userid && e.IsActive == false select e.UserId).ToList().Count > 0) { w.statusMessage = "You are Blocked by Admin"; } else { var query = (from e in dbcontext.tblWishlists join d in dbcontext.tblBooks on e.ISBN equals d.ISBN join x in dbcontext.tblUsers on e.UserId equals x.UserId where e.UserId == userid select new WishListModel() { id = e.id, ISBN = e.ISBN, UserId = e.UserId, price = d.Price, Publisher = d.Publisher, Author = d.Author, rating = d.Rating, BookName = d.BookName, BookImageUrl = d.BookImageUrl }).ToList(); w.statusList = query; if (query.Count > 0) { w.statusMessage = " Items in Wishlist"; } else { w.statusMessage = "no items in wishlist"; } } } } catch (Exception e) { w.statusMessage = e.Message; } return(w); }
//calls the action in service DAlayer which displays all book present in the wishlist public WishListStatus displayAllItems(int userid) { WishListStatus a = service.displayAllItems(userid); return(a); }
//calls the action in service DAlayer which gets the details of the book in the wishlist public WishListStatus getBookDetails(int wishListId) { WishListStatus a = service.getBookDetails(wishListId); return(a); }