Beispiel #1
0
        public HttpResponseMessage Post([FromBody] Models.product_price_mapping productPrice, long create_by)
        {
            try
            {
                if (productPrice.product_id == null || productPrice.product_id == 0)
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "Select Product Name"
                    }, formatter));
                }
                if (productPrice.has_serial == true)
                {
                    if (productPrice.color_id == null || productPrice.color_id == 0)
                    {
                        var formatter = RequestFormat.JsonFormaterString();
                        return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                            output = "error", msg = "Select Color"
                        }, formatter));
                    }
                }

                if (!_mappingRepository.CheckDuplicatePriceing(productPrice))
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "Same Product And Version Mapping Already Exists! "
                    }, formatter));
                }
                else
                {
                    _mappingRepository.AddProductPriceing(productPrice, create_by);
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "success", msg = "Mapping Saved"
                    }, formatter));
                }
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }
Beispiel #2
0
        public HttpResponseMessage Delete([FromBody] Models.product_price_mapping productPrice)
        {
            try
            {
                bool deleteArea = _mappingRepository.DeleteProductPriceing(productPrice.product_price_mapping_id);

                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "success", msg = "Mapping Deleted Successfully."
                }, formatter));
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }
Beispiel #3
0
        public HttpResponseMessage Put([FromBody] Models.product_price_mapping productPrice, long update_by)
        {
            try
            {
                _mappingRepository.EditProductPricing(productPrice, update_by);

                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "success", msg = "Mapping Update Successfully"
                }, formatter));
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }