// GET: api/SchoolRegistrationAPI public HttpResponseMessage Get() { try { SchoolRegistrationBLL _objSchoolRegistration = new SchoolRegistrationBLL(); List <SchoolRegistrationModel> record = _objSchoolRegistration.GetSchoolRegistrations(); if (record == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Record Not Found!")); } else { return(Request.CreateResponse(HttpStatusCode.OK, record)); } } catch (SecurityException ex) { return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, ex.InnerException)); } catch (Exception ex) { HttpRequestMessage Request = new HttpRequestMessage(); //new EventLogManager().LogException(ex); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
// POST: api/Exporter public HttpResponseMessage Post(SchoolRegistrationModel schoolModel) { try { SchoolRegistrationBLL _objSchoolRegistration = new SchoolRegistrationBLL(); var insertedRecord = _objSchoolRegistration.InsertSchool(schoolModel); if (insertedRecord == null || insertedRecord == 0) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "School Not Created!")); } else { return(Request.CreateResponse(HttpStatusCode.OK, insertedRecord)); } } catch (SecurityException ex) { return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, ex.InnerException)); } catch (Exception ex) { HttpRequestMessage Request = new HttpRequestMessage(); //new EventLogManager().LogException(ex); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }