Ejemplo n.º 1
0
        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);
        }