public HttpResponseMessage EditTask(Task task) { HttpResponseMessage response = null; try { if (task != null) { if (TaskRepo.GetTaskById(task.id) != null) { TaskRepo.EditTask(task); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Task updated successfully", "Task updated successfully")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_801", "Task doesnot Exists", "Task 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 DeleteTask(int task_id)//t_id task_id { HttpResponseMessage response = null; try { if (task_id != 0) { Task instance = TaskRepo.GetTaskById(task_id); if (instance != null) { TaskRepo.DeleteTaskById(instance); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Task deleted successfully!", "Task deleted successfully!")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_801", "Task doesnot exists", "Task doesnot exists")); } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_802", "Please check the input and datatype", "Please check the input and datatype")); } } 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 EducationObject GetTaskById(EducationObject task) { return(_repo.GetTaskById(task)); }