示例#1
0
        public OrderItemDTO UpdateOrderItem(UpdateOrderItemDTO updatedRecord)
        {
            try
            {
                string query = @"
                UPDATE OrderItems
                SET ItemID = @ItemID,
                    OrderItemUnitPrice = @OrderItemUnitPrice,
                    OrderItemUnitPriceAfterDiscount = @OrderItemUnitPriceAfterDiscount,
                    OrderItemQty = @OrderItemQty,
                    OrderItemDescription = @OrderItemDescription
                WHERE OrderItemID = @OrderItemID";

                var queryParameters = new DynamicParameters();
                queryParameters.Add("@ItemID", updatedRecord.ItemID);
                queryParameters.Add("@OrderItemDescription", updatedRecord.OrderItemDescription);
                queryParameters.Add("@OrderItemID", updatedRecord.OrderItemID);
                queryParameters.Add("@OrderItemQty", updatedRecord.OrderItemQty);
                queryParameters.Add("@OrderItemUnitPrice", updatedRecord.OrderItemUnitPrice);
                queryParameters.Add("@OrderItemUnitPriceAfterDiscount", updatedRecord.OrderItemUnitPriceAfterDiscount);

                int rowsUpdated = Connection.Execute(query, queryParameters, CurrentTrans);
                return((rowsUpdated > 0) ? GetOrderItemByID(updatedRecord.OrderItemID) : throw noRecordEX);
            }
            catch (Exception ex)
            {
                throw SqlExceptionHandler.HandleSqlException(ex) ?? ex;
            }
        }
示例#2
0
 public OrderItemDTO UpdateOrderItem(UpdateOrderItemDTO updatedRecord)
 {
     try
     {
         OrderItemDTO returnModel = UOW.OrderRepo.UpdateOrderItem(updatedRecord);
         UOW.SaveChanges();
         return(returnModel);
     }
     catch (Exception ex)
     {
         UOW.RollbackChanges();
         throw ex;
     }
 }
示例#3
0
 public ActionResult <OrderItemDTO> UpdateOrderItem(UpdateOrderItemDTO updatedRecord)
 {
     try { return(_orderManager.UpdateOrderItem(updatedRecord)); }
     catch (BaseCustomException ex) { return(BadRequest(ex.Message)); }
 }
示例#4
0
 public OrderItemDTO UpdateOrderItem(UpdateOrderItemDTO updatedRecord)
 {
     return(_orderService.UpdateOrderItem(updatedRecord));
 }