public IHttpActionResult EditEndTask([FromBody] TaskModel taskModel) { if (!ModelState.IsValid) { return(BadRequest("Not a valid data")); } try { TaskManagerRepository taskRep = new TaskManagerRepository(); Task_Tbl taskDb = taskRep.GetTaskRepo(taskModel.TaskId); if (taskDb != null) { string result = "{'TaskID': " + taskRep.EditEndTask(taskModel.TaskId, taskModel.IsCompleted) + "}"; JObject json = JObject.Parse(result); return(Ok <JObject>(json)); } else { return(BadRequest("Error occurred during data update in EditEndTask")); } } catch (Exception ex) { return(BadRequest("Error occurred in EditEndTask :" + ex.StackTrace)); } }