public bool UpdateBookProduct(BookProductModel m) { try { book_product bp = IQueryable().FirstOrDefault(o => o.book_product_id == m.book_product_id); bp.book_product_name = m.book_product_name; bp.book_product_price = m.book_product_price; dbh.SaveChanges(); return(true); } catch (Exception ex) { throw ex; } }
public ActionResult UpdateBookProduct(BookProductModel bookProd) { try { bool updated = bookProductHelp.UpdateProduct(bookProd); if (updated) { var bookProduct = bookProductHelp; return(Json(bookProduct, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddBookProduct(BookProductModel bookProd) { try { bool added = bookProductHelp.AddBookProduct(bookProd); if (added) { var bookProductList = bookProductHelp; return(Json(bookProductList, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public bool AddBookProduct(BookProductModel m) { try { if (IQueryable().Where(o => o.book_product_name == m.book_product_name).ToList().Count == 0) { book_product _obj = Mapping(m); dbh.book_product.Add(_obj); dbh.SaveChanges(); // book_product bp = IQueryable().FirstOrDefault(o => o.book_product_id == m.book_product_id); // bp = Mapping(m); //dbh.SaveChanges(); return(true); } return(false); } catch (Exception ex) { throw ex; } }
internal book_product Mapping(BookProductModel c) { try { if (c != null) { return(new book_product() { book_product_id = c.book_product_id, book_product_name = c.book_product_name, book_product_price = c.book_product_price, book_product_qty = c.book_product_qty, book_type_id = c.book_type_id, book_category_id = c.book_category_id }); } return(null); } catch (Exception ex) { throw ex; } }
public bool UpdateProduct(BookProductModel bookProd) { return(new BookProductLibrary().UpdateBookProduct(bookProd)); }
public bool AddBookProduct(BookProductModel bookProd) { return(new BookProductLibrary().AddBookProduct(bookProd)); }