public HttpResponseMessage Post([FromBody] Models.currency currency) { try { if (string.IsNullOrEmpty(currency.currency_name)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Currency is Empty" }, formatter)); } else { if (currencyRepository.CheckDuplicateCurrency(currency.currency_name)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Currency Already Exists" }, formatter)); } else { currency insert_currency = new currency { currency_name = currency.currency_name }; currencyRepository.AddCurrency(insert_currency); var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "success", msg = "Currency save successfully" }, formatter)); } } } catch (Exception ex) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = ex.ToString() }, formatter)); } }