Beispiel #1
0
        public IHttpActionResult getInvoiceTermsandConditions()
        {
            Response <InvoiceTermsandConditions> output = new Response <InvoiceTermsandConditions>();

            try
            {
                long?headerUserId = null;
                var  re           = Request;
                var  headers      = re.Headers;
                if (headers.Contains("User"))
                {
                    string strUserId = headers.GetValues("User").First();
                    headerUserId = Convert.ToInt64(strUserId);
                }
                InvoiceTermsandConditions invoiceTandC = invoiceMethods.GetInvoiceTandC();
                output.Status  = true;
                output.Message = "";
                output.Data    = invoiceTandC;
                //return response= Request.CreateResponse(HttpStatusCode.OK, (JObject.FromObject(output)));
                return(Ok(JObject.FromObject(output)));
            }
            catch (Exception ex)
            {
                output.Status  = true;
                output.Message = ex.Message;
                //return Request.CreateResponse(HttpStatusCode.InternalServerError, JObject.FromObject(output));
                return(InternalServerError(ex));
            }
        }
Beispiel #2
0
        public IHttpActionResult updateInvoiceTermsandConditions([FromBody] InvoiceTermsandConditions InvoiceTandC)
        {
            Response <string> output = new Response <string>();

            try
            {
                long?headerUserId = null;
                var  re           = Request;
                var  headers      = re.Headers;
                if (headers.Contains("User"))
                {
                    string strUserId = headers.GetValues("User").First();
                    headerUserId = Convert.ToInt64(strUserId);
                }
                bool isinvoiceTandCupdated = invoiceMethods.UpdateInvoiceTandC(InvoiceTandC.termsandconditions, headerUserId);
                if (isinvoiceTandCupdated)
                {
                    output.Status  = true;
                    output.Message = "Terms and conditions updated successfully";
                    output.Data    = "";
                }
                else
                {
                    output.Status  = false;
                    output.Message = "Operation failed";
                }
                //return response= Request.CreateResponse(HttpStatusCode.OK, (JObject.FromObject(output)));
                return(Ok(JObject.FromObject(output)));
            }
            catch (Exception ex)
            {
                output.Status  = true;
                output.Message = ex.Message;
                //return Request.CreateResponse(HttpStatusCode.InternalServerError, JObject.FromObject(output));
                return(InternalServerError(ex));
            }
        }