Ejemplo n.º 1
0
        public HttpResponseMessage CreateBlog(HttpRequestMessage request)
        {
            var data = request.Content.ReadAsStringAsync().Result;

            if (data == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest)
                {
                    Content = new StringContent("Post data is empty")
                });
            }
            else
            {
                var blogdata = JsonConvert.DeserializeObject <BlogWrapper>(data);
                if (blogService.GetGMapsMarker().Count > 0)
                {
                    blogdata.blog.gmapsMarker = blogService.GetGMapsMarker();
                }
                blogService.SetBlogData(blogdata.blog);
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
        }