public IActionResult AddPost(Blog b)
        {
            BlogDB db = new BlogDB(_conn);

            db.AddPost(b);
            return(Redirect($"/Home/IndexPost?BlogId={b.BlogId}"));
        }
        public IActionResult SubmitPost(BlogPost bp)
        {
            BlogDB db = new BlogDB(_connectionString);

            db.AddPost(bp);
            return(Redirect($"/Home/Index"));
        }
        public object Post(BlogItemInput input)
        {
            int?         imageId   = null;
            MemoryStream imageData = new MemoryStream();

            if (input.Image != null && input.Image.Length > 0)
            {
                CopyStream(input.Image.OpenStream(), imageData);
                ImageDB.ImageEntry imageEntry = ImageDB.AddImage(input.Image.FileName, input.Image.ContentType, imageData);
                imageId = imageEntry.Id;
            }

            BlogDB.PostEntry postEntry = BlogDB.AddPost(input.Title, input.Text, 1, imageId);

            BlogItemHandler h           = new BlogItemHandler();
            BlogItem        createdItem = h.Get(postEntry.Id);

            return(new OperationResult.Created
            {
                ResponseResource = createdItem,
                RedirectLocation = typeof(BlogItem).CreateUri(new { id = postEntry.Id })
            });
        }