// OrderDetail Functions started public int AddOrderDetail(OrderDetailDTO obj) { OrderDetailProvider provider = new OrderDetailProvider(); if (provider.GetOrderDetailById(obj.OrderDetailId) == null) { provider.AddOrderDetail(obj); return(1); } return(-1); }
public int DeleteOrderDetail(int id) { OrderDetailProvider provider = new OrderDetailProvider(); var obj = provider.GetOrderDetailById(id); if (obj != null) { provider.DeleteOrderDetail(obj); return(1); } return(-1); }
public IActionResult Get(Int32 OrderId) { try { OrderDetailProvider Provider = new OrderDetailProvider(OrderDB); OrderTotal Total = Provider.GetTotalForOrder(OrderId); if (Total == null) { return(NotFound()); } return(new ObjectResult(Total)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult Get(Int32 OrderId) { try { OrderDetailProvider Provider = new OrderDetailProvider(OrderDB); IEnumerable <OrderDetail> Details = Provider.GetDetailsForOrder(OrderId); if (Details == null) { return(NotFound()); } return(new ObjectResult(Details)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public int DeleteOrder(int id) { OrderProvider provider = new OrderProvider(); OrderDTO obj = provider.GetOrderById(id); var orderDet = new OrderDetailProvider(); foreach (var det in obj.OrderDetails) { var stPro = new StockOutProvider(); foreach (var stOut in det.StockOuts) { stPro.DeleteStockOut(stOut); } orderDet.DeleteOrderDetail(det); } if (obj != null) { provider.DeleteOrder(obj); return(1); } return(-1); }
public int UpdateOrderDetail(OrderDetailDTO obj) { OrderDetailProvider provider = new OrderDetailProvider(); return(provider.UpdateOrderDetail(obj)); }
public IList <OrderDetailDTO> GetOrderDetails() { OrderDetailProvider provider = new OrderDetailProvider(); return(provider.GetAllOrderDetails()); }
public OrderDetailDTO GetOrderDetail(int id) { OrderDetailProvider provider = new OrderDetailProvider(); return(provider.GetOrderDetailById(id)); }