Esempio n. 1
0
        public void Delete(int id)
        {
            var procedure = new ProcedureSql("Delete_Category");

            procedure.AddParameter("@Id", id);
            procedure.Execute();
        }
Esempio n. 2
0
        public void Update(Post obj)
        {
            var procedure = new ProcedureSql("Update_Post");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@AuthorId", obj.Author.Id);
            procedure.AddParameter("@Title", obj.Title);
            procedure.AddParameter("@Body", obj.Body);
            procedure.AddParameter("@IsPublished", obj.IsPublished);

            // Sql Server 2008 compatible
            // http://www.mssqltips.com/sqlservertip/2112/table-value-parameters-in-sql-server-2008-and-net-c/
            var categories = new DataTable();

            categories.Columns.Add("Id", typeof(Int32));
            if (obj.Categories != null)
            {
                foreach (Category category in obj.Categories)
                {
                    categories.Rows.Add(category.Id);
                }
            }
            procedure.AddParameter("@Categories", categories, SqlDbType.Structured);

            procedure.Execute();
        }
Esempio n. 3
0
        public void Delete(int id)
        {
            var procedure = new ProcedureSql("Update_Post");

            procedure.AddParameter("@Id", id);
            procedure.Execute();
        }
Esempio n. 4
0
        public void Delete(int id)
        {
            var procedure = new ProcedureSql("Delete_Comment");

            procedure.AddParameter("@Id", id);

            procedure.Execute();           
        }
Esempio n. 5
0
        public void Update(Category obj)
        {
            var procedure = new ProcedureSql("Update_Category");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@Name", obj.Name);

            procedure.Execute();
        }
        public void Update(Category obj)
        {
            var procedure = new ProcedureSql("Update_Category");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@Name", obj.Name);

            procedure.Execute();
        }
        public void Update(Author obj)
        {
            var procedure = new ProcedureSql("Update_Author");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@Name", obj.Name);
            procedure.AddParameter("@Email", obj.Email);
            procedure.AddParameter("@Password", obj.Password);
            procedure.AddParameter("@IsActive", obj.IsActive);

            procedure.Execute();
        }
Esempio n. 8
0
        public void Update(Author obj)
        {
            var procedure = new ProcedureSql("Update_Author");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@Name", obj.Name);
            procedure.AddParameter("@Email", obj.Email);
            procedure.AddParameter("@Password", obj.Password);
            procedure.AddParameter("@IsActive", obj.IsActive);

            procedure.Execute();          
        }
Esempio n. 9
0
        public void Update(Comment obj)
        {
            var procedure = new ProcedureSql("Update_Comment");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@PostId", obj.PostId);
            procedure.AddParameter("@Name", obj.Name);
            procedure.AddParameter("@Email", obj.Email);
            procedure.AddParameter("@Url", obj.Url);
            procedure.AddParameter("@Body", obj.Body);
            procedure.AddParameter("@Status", obj.Status);
            procedure.AddParameter("@DateCreated", obj.DateCreated);

            procedure.Execute();
        }
        public void Update(Comment obj)
        {
            var procedure = new ProcedureSql("Update_Comment");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@PostId", obj.PostId);
            procedure.AddParameter("@Name", obj.Name);
            procedure.AddParameter("@Email", obj.Email);
            procedure.AddParameter("@Url", obj.Url);
            procedure.AddParameter("@Body", obj.Body);
            procedure.AddParameter("@Status", obj.Status);
            procedure.AddParameter("@DateCreated", obj.DateCreated);

            procedure.Execute();
        }
Esempio n. 11
0
 public void Delete(int id)
 {
     var procedure = new ProcedureSql("Update_Post");
     procedure.AddParameter("@Id", id);
     procedure.Execute();            
 }
Esempio n. 12
0
        public void Update(Post obj)
        {
            var procedure = new ProcedureSql("Update_Post");

            procedure.AddParameter("@Id", obj.Id);
            procedure.AddParameter("@AuthorId", obj.Author.Id);
            procedure.AddParameter("@Title", obj.Title);
            procedure.AddParameter("@Body", obj.Body);
            procedure.AddParameter("@IsPublished", obj.IsPublished);

            // Sql Server 2008 compatible
            // http://www.mssqltips.com/sqlservertip/2112/table-value-parameters-in-sql-server-2008-and-net-c/
            var categories = new DataTable();
            categories.Columns.Add("Id", typeof(Int32));
            if (obj.Categories != null)
            {
                foreach (Category category in obj.Categories)
                {
                    categories.Rows.Add(category.Id);
                }
            }
            procedure.AddParameter("@Categories", categories, SqlDbType.Structured);

            procedure.Execute();            
        }