public bool UpdateQuantityOrder(long productId, decimal qtyUpdate, Enums.OrderType orderType = Enums.OrderType.SalesOrder) { var oldDetails = GetAll().Where(p => p.ProductId == productId).FirstOrDefault(); var newDetails = new ProductDto(); if (oldDetails.IsNull()) { return(false); } else { newDetails = oldDetails; switch (orderType) { case Enums.OrderType.SalesOrder: newDetails.Quantity = newDetails.Quantity - qtyUpdate; break; } var details = newDetails.DtoToEntity(); if (this._product.Update2(details).IsNull()) { return(false); } } return(true); }
public long SaveProduct(ProductDto dto) { this.product = dto.DtoToEntity(); if (this._product.Insert(this.product).IsNull()) { return(0); } return(this.product.ProductID); }
public bool UpdateDetails(ProductDto newDetails) { var details = newDetails.DtoToEntity(); if (this._product.Update2(details).IsNull()) { return(false); } return(true); }
public long SaveDetails(ProductDto newDetails) { this.product = newDetails.DtoToEntity(); var insertedProduct = this._product.Insert(this.product); if (insertedProduct.IsNull()) { return(0); } return(insertedProduct.ProductID); }