public Notify Update(POS_PRODUCT ProductModel) { try { objNotify.RowEffected = _objDALProduct.UpdateProduct(ProductModel); if (objNotify.RowEffected > 0) { objNotify.NotifyMessage = "Record Updated Successfully"; } else { objNotify.NotifyMessage = "Product Not Updated"; } return(objNotify); } catch (Exception ex) { if (ex is DALException) { throw ex; } else { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); } throw new BALException(ex.Message.ToString()); } }
public static int UpdateProduct(int productId, string productName, ref List <string> errors) { if (productId <= 0 || productId > DALProduct.ReadProductList(ref errors).Count) { errors.Add("Invalid product id"); } if (errors.Count > 0) { return(-1); } return(DALProduct.UpdateProduct(productId, productName, ref errors)); }
public void UpdateProductTest() { int myId = 1; Random rand = new Random(); ProductInfo pi = new ProductInfo(myId, "turtle neck " + rand.Next(10000)); List <string> errors = new List <string>(); int result = DALProduct.UpdateProduct(pi.product_id, pi.product_name, ref errors); Assert.AreEqual(0, errors.Count); Assert.AreNotEqual(-1, result); ProductInfo verify = DALProduct.ReadProductDetail(myId, ref errors); Assert.AreEqual(0, errors.Count); Assert.AreEqual(pi.product_id, verify.product_id); Assert.AreEqual(pi.product_name, verify.product_name); }
public bool UpdateProduct(Product product) { return(productDAL.UpdateProduct(product)); }