public HttpResponseMessage GetSheetById(int timesheetid)//timesheet id { HttpResponseMessage response = null; try { if (timesheetid != 0) { TimeSheetModel record = TimeSheetRepo.GetSheetById(timesheetid); if (record != null) { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", record)); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_901", "Invalid", "TimeSheet doesnot exists!")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
public HttpResponseMessage EditTimeSheetRecord(Timesheet sheetdetails) { HttpResponseMessage response = null; try { if (sheetdetails != null) { if (TimeSheetRepo.GetSheetById(sheetdetails.id) != null) { TimeSheetRepo.UpdateTimeSheetRecord(sheetdetails); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", "TimeSheet updated Succesfully")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_901", "Invalid", "TimeSheet doesnot exists!")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }