예제 #1
0
        public HttpResponseMessage Post(Amigo amigo)
        {
            try
            {
                if (amigo == null)
                {
                    throw new ArgumentNullException("amigo");
                }

                if (amigo.create(amigo))
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, "Cadastro efetuado!"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, Amigo.log));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }