Example #1
0
        public HttpResponseMessage Post([FromBody] Models.payment_method objPaymentMethod, long?created_by)
        {
            try
            {
                if (string.IsNullOrEmpty(objPaymentMethod.payment_method_name))
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "Payment method name is Empty"
                    }, formatter));
                }
                else
                {
                    if (paymentMethodRepository.CheckDuplicatePaymentMethod(objPaymentMethod.payment_method_name))
                    {
                        var formatter = RequestFormat.JsonFormaterString();
                        return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                            output = "error", msg = "Payment method name Exists"
                        }, formatter));
                    }
                    else
                    {
                        payment_method insert_payment_method = new payment_method
                        {
                            payment_method_name = objPaymentMethod.payment_method_name,
                            is_active           = true,
                            is_deleted          = false,
                            created_by          = objPaymentMethod.created_by,
                            created_date        = DateTime.Now
                        };

                        paymentMethodRepository.InsertPaymentMethod(insert_payment_method, created_by);
                        var formatter = RequestFormat.JsonFormaterString();
                        return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                            output = "success", msg = "Payment method save successfully"
                        }, formatter));
                    }
                }
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }
Example #2
0
 public int InsertPaymentMethod(PaymentMethodModel PaymentMethodModel)
 {
     return(_IPaymentMethodReportsitory.InsertPaymentMethod(PaymentMethodModel));
 }