示例#1
0
 public void Delete(Clothe entity)
 {
     using (SqlCommand cmd =
                new SqlCommand("DELETE FROM Clothes WHERE ClotheId = @ClotheId"))
     {
         cmd.Parameters.AddWithValue("ClotheId", entity.ClotheId);
         VTYS.SqlExecuteNonQuery(cmd);
     }
 }
示例#2
0
 public void Delete(Post entity)
 {
     using (SqlCommand cmd =
                new SqlCommand("DELETE FROM Posts WHERE PostId = @PostId"))
     {
         cmd.Parameters.AddWithValue("PostId", entity.PostId);
         VTYS.SqlExecuteNonQuery(cmd);
     }
 }
示例#3
0
 public void Add(Clothe entity)
 {
     using (SqlCommand cmd = new SqlCommand("INSERT INTO Clothes (Name,UnitPrice) " +
                                            "VALUES(@Name,@UnitPrice)"))
     {
         cmd.Parameters.AddWithValue("Name", entity.Name);
         cmd.Parameters.AddWithValue("UnitPrice", entity.UnitPrice);
         VTYS.SqlExecuteNonQuery(cmd);
     }
 }
示例#4
0
 public void Update(Clothe entity)
 {
     using (SqlCommand cmd = new SqlCommand("UPDATE Clothes set Name = @Name, UnitPrice=@UnitPrice WHERE ClotheId = @ClotheId"))
     {
         cmd.Parameters.AddWithValue("@ClotheId", entity.ClotheId);
         cmd.Parameters.AddWithValue("@Name", entity.Name);
         cmd.Parameters.AddWithValue("@UnitPrice", entity.UnitPrice);
         VTYS.SqlExecuteNonQuery(cmd);
     }
 }
示例#5
0
 public void Add(Post entity)
 {
     using (SqlCommand cmd = new SqlCommand("INSERT INTO Posts (Title,Details) " +
                                            "VALUES(@Title,@Details)"))
     {
         cmd.Parameters.AddWithValue("Title", entity.Title);
         cmd.Parameters.AddWithValue("Details", entity.Details);
         VTYS.SqlExecuteNonQuery(cmd);
     }
 }
示例#6
0
 public void Update(Post entity)
 {
     using (SqlCommand cmd = new SqlCommand("UPDATE Posts set Title = @Title, Details=@Details WHERE PostId = @PostId"))
     {
         cmd.Parameters.AddWithValue("@PostId", entity.PostId);
         cmd.Parameters.AddWithValue("@Title", entity.Title);
         cmd.Parameters.AddWithValue("@Details", entity.Details);
         VTYS.SqlExecuteNonQuery(cmd);
     }
 }