public IHttpActionResult addUser([FromBody] UsersModel user) { if (!ModelState.IsValid) { return(BadRequest("Not a valid data")); } try { if (user != null)//if 0 for no chnage in parent task { TaskManagerRepository tmRep = new TaskManagerRepository(); User_Tbl userDb = new User_Tbl { First_Name = user.FirstName, Last_Name = user.LastName, Employee_ID = user.EmpID, }; string result = "{'UserID': " + tmRep.addUser(userDb) + "}"; JObject json = JObject.Parse(result); return(Ok <JObject>(json)); } else { return(BadRequest("Error occurred in AddUser")); } } catch (Exception ex) { return(BadRequest("Error occurred in AddUser :" + ex.StackTrace)); } }