public bool Create(BasketResultEntity entity) { string sql = "INSERT INTO Basket (BasketId, CustomerId, ProductId, Quantity) Values (@BasketId, @CustomerId, @ProductId, @Quantity);"; using (var connection = new SqlConnection(config.GetValue <string>("Conn"))) { var affectedRows = connection.Execute(sql, entity); } return(true); }
public bool Update(BasketResultEntity entity) { string sql = "UPDATE[Basket] SET[BasketId] = @BasketId ,[CustomerId] = @CustomerId , [ProductId] = @ProductId , [Quantity] = @Quantity WHERE BasketId = " + entity.BasketId; using (var connection = new SqlConnection(config.GetValue <string>("Conn"))) { var affectedRows = connection.Execute(sql, entity); } return(true); }