예제 #1
0
        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);
        }