public HttpResponseMessage Task([FromBody] Tasks a) { //return p.findByName(a.Name); //return p.findByEmail(a.email); try { t.AddTaskWS(a); var message = Request.CreateErrorResponse(HttpStatusCode.Created, t.ToString()); message.Headers.Location = new Uri(Request.RequestUri + t.ToString()); return(message); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }