// POST: api/LeaveTypes public HttpResponseMessage InsertLeaveType(LeaveTypeVM leaveTypesVM) { try { var message = Request.CreateErrorResponse(HttpStatusCode.NotFound, "404 : Data Not Found"); var result = iLeaveTypesService.Insert(leaveTypesVM); if (result) { message = Request.CreateResponse(HttpStatusCode.OK, leaveTypesVM); } return(message); } catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500 : Internal Server Error")); } }