Пример #1
0
        // POST api/youtube
        public HttpResponseMessage Post([FromBody] Channel value)
        {
            HttpResponseMessage response;

            if (!Object.Equals(null, value))
            {
                Channel cr = _ytService.Create(value);
                response = Request.CreateResponse(HttpStatusCode.Created);
                response.Headers.Location = new Uri(Url.Link("YouTubeActionApi", new { user = cr.Name, controller = "youtube", action = "channel" }));
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            return(response);
        }