Esempio n. 1
0
        public Blog AddBlog(AddBlogCommand newBlog)
        {
            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();

                var sql = @"INSERT INTO [dbo].[Blog]
	                                ([Title]
	                                ,[Article ]
                                    ,[ImageUrl]
                                    ,[UserId])
                                 output inserted.*
                                 VALUES
	                                (@Title
                                    ,@Article 
                                     ,@ImageUrl
                                     ,@UserId)";


                return(connection.QueryFirst <Blog>(sql, newBlog));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> SaveBlog(AddBlogCommand command)
        {
            await _mediator.Send(command, CancellationToken);

            return(NoContent());
        }
Esempio n. 3
0
        public void Create(AddBlogCommand newBlog)
        {
            var repo = new BlogRepository();

            repo.AddBlog(newBlog);
        }