public HttpResponseMessage Post([FromBody] Models.terms_and_condition objTermsAndCondition) { try { if (string.IsNullOrEmpty(objTermsAndCondition.terms_and_condition_description)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Terms And Condition is Empty" }, formatter)); } if (string.IsNullOrEmpty(objTermsAndCondition.terms_condition_header)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Terms And Condition Header is Empty" }, formatter)); } if (_termsAndConditionRepository.CheckDuplicatetermsAndCondition(objTermsAndCondition.terms_and_condition_description)) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = "Already Exists! " }, formatter)); } else { terms_and_condition objTAndC = new terms_and_condition { terms_and_condition_description = objTermsAndCondition.terms_and_condition_description, terms_condition_header = objTermsAndCondition.terms_condition_header, is_active = objTermsAndCondition.is_active = true, created_by = objTermsAndCondition.created_by, created_date = DateTime.Now }; _termsAndConditionRepository.AddTermsAndCondition(objTAndC); var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "success", msg = "Terms And Condition saved successfully" }, formatter)); } } catch (Exception ex) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = ex.ToString() }, formatter)); } }
public HttpResponseMessage Delete([FromBody] Models.terms_and_condition objTermsAndCondition) { try { bool deleteArea = _termsAndConditionRepository.DeleteTermsAndCondition(objTermsAndCondition.terms_and_condition_id); var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "success", msg = "Deleted Successfully." }, formatter)); } catch (Exception ex) { var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { output = "error", msg = ex.ToString() }, formatter)); } }