Esempio n. 1
0
        public HttpResponseMessage Post([FromBody] Post a)
        {
            //return p.findByName(a.Name);
            //return p.findByEmail(a.email);

            try
            {
                p.AddPostWS(a);

                var message = Request.CreateErrorResponse(HttpStatusCode.Created, p.ToString());
                message.Headers.Location = new Uri(Request.RequestUri + p.ToString());

                return(message);
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }