예제 #1
0
        public HttpResponseMessage Remove(int id)
        {
            try
            {
                var cartitembs = new CartItemBusiness();


                cartitembs.Borrar(id);

                var httpok = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)200,
                    ReasonPhrase = "Item Eliminado"
                };
                return(httpok);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #2
0
 public CartItem AddCart(CartItem cartItem)
 {
     try
     {
         var cib = new CartItemBusiness();
         return(cib.Create(cartItem));
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode = (HttpStatusCode)422,
             Content    = new StringContent(ex.Message + "+" + ex.InnerException),
         };
         throw new HttpResponseException(httpError);
     }
 }
예제 #3
0
 public CartItem Add(CartItem cartitem)
 {
     try
     {
         var cartitembs = new CartItemBusiness();
         return(cartitembs.nuevo(cartitem));
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
 public CartItem AddCart(CartItem cartItem)
 {
     try
     {
         var bc = new CartItemBusiness();
         return(bc.Create(cartItem));
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message + "+" + ex.InnerException
         };
         throw new HttpResponseException(httpError);
     }
 }
예제 #5
0
        public void Remove(int id)
        {
            try
            {
                var bc = new CartItemBusiness();
                bc.Remove(id);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #6
0
        public void Remove(int id)
        {
            try
            {
                var cib = new CartItemBusiness();
                cib.Delete(id);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode = (HttpStatusCode)422,
                    Content    = new StringContent(ex.Message),
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #7
0
        public CartItem Find(int id)
        {
            try
            {
                var cib = new CartItemBusiness();
                return(cib.GetById(id));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode = (HttpStatusCode)422,
                    Content    = new StringContent(ex.Message),
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #8
0
        public List <CartItem> List()
        {
            try
            {
                var cartitembs = new CartItemBusiness();
                return(cartitembs.ListarTodosCartItems());
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #9
0
        public CartItem GetById(int id)
        {
            try
            {
                var cartitembs = new CartItemBusiness();
                return(cartitembs.GetbyID(id));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #10
0
        public CartItem Find(int id)
        {
            try
            {
                var bc = new CartItemBusiness();
                return(bc.GetCartItem(id));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #11
0
        public void Edit(CartItem cartItem)
        {
            try
            {
                var bc = new CartItemBusiness();
                bc.EditarCartItem(cartItem);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #12
0
        public void Edit(CartItem cartItem)
        {
            try
            {
                var cib = new CartItemBusiness();
                cib.Edit(cartItem);
            }
            catch (Exception ex)
            {
                // Repack to Http error.
                var httpError = new HttpResponseMessage()
                {
                    StatusCode = (HttpStatusCode)422,
                    Content    = new StringContent(ex.Message),
                };

                throw new HttpResponseException(httpError);
            }
        }
예제 #13
0
        public FindResponseCartItem Find(int id)
        {
            try
            {
                var response = new FindResponseCartItem();
                var bc       = new CartItemBusiness();
                response.Result = bc.Find(id);
                return(response);
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }