public OrderDetail AddOrderdetail(OrderDetail orderdetail)
 {
     try
     {
         var orderdetailbs = new OrderDetailBusiness();
         return(orderdetailbs.nuevo(orderdetail));
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
        public List <OrderDetail> List_OrderDetail()
        {
            try
            {
                var ordedetailrbs = new OrderDetailBusiness();
                return(ordedetailrbs.ListarTodas());
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
        public List <OrderDetail> GetOrderDetail_By_OrderID(int id)
        {
            try
            {
                var orderdetailbs = new OrderDetailBusiness();
                return(orderdetailbs.GetbyOrderId(id));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
        public void RemoveOrderDetail(int id)
        {
            try
            {
                var orderdetailrbs = new OrderDetailBusiness();
                orderdetailrbs.Borrar(orderdetailrbs.GetbyID(id));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#5
0
 public OrderDetail Add(OrderDetail orderDetail)
 {
     try
     {
         var odb = new OrderDetailBusiness();
         return(odb.Create(orderDetail));
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message + "+" + ex.InnerException,
             Content      = new StringContent(ex.Message)
         };
         throw new HttpResponseException(httpError);
     }
 }
示例#6
0
        public void Remove(int id)
        {
            try
            {
                var bo = new OrderDetailBusiness();
                bo.Remove(id);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
        public OrderDetail Add(OrderDetail item)
        {
            try
            {
                var bc = new OrderDetailBusiness();
                return(bc.AgregarOrderDetail(item));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
        public OrderDetail Find(int id)
        {
            try
            {
                var bc = new OrderDetailBusiness();
                return(bc.GetOrderDetail(id));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#9
0
        public OrderDetail Find(int id)
        {
            try
            {
                var odb = new OrderDetailBusiness();
                return(odb.GetById(id));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message,
                    Content      = new StringContent(ex.Message),
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#10
0
        public void Remove(int id)
        {
            try
            {
                var odb = new OrderDetailBusiness();
                odb.Delete(id);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message,
                    Content      = new StringContent(ex.Message)
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#11
0
        public void Edit(OrderDetail orderDetail)
        {
            try
            {
                var bo = new OrderDetailBusiness();
                orderDetail.ChangedOn = System.DateTime.Now;
                bo.Edit(orderDetail);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#12
0
        public FindOrderDetailResponse Find(int id)
        {
            try
            {
                var response = new FindOrderDetailResponse();
                var bo       = new OrderDetailBusiness();
                response.Result = bo.Find(id);
                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#13
0
        public AllOrderDetailResponse FindByOrderId(int on)
        {
            try
            {
                var response = new AllOrderDetailResponse();
                var odb      = new OrderDetailBusiness();
                response.Result = odb.FindByOrderId(on);
                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#14
0
        public void Edit(OrderDetail orderDetail)
        {
            try
            {
                if (orderDetail == null)
                {
                    throw new Exception("Object can not be null!");
                }

                var odb = new OrderDetailBusiness();
                odb.Edit(orderDetail);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message,
                    Content      = new StringContent(ex.Message),
                };

                throw new HttpResponseException(httpError);
            }
        }