public void Acc_Products_NullCrud() { //add a new product Product product = new Product(); product.CategoryID = 1; product.Discontinued = false; product.ProductName = "Unit Test Product"; product.QuantityPerUnit = null; product.ReorderLevel = null; product.SupplierID = null; product.UnitPrice = null; product.UnitsInStock = null; product.UnitsOnOrder = null; product.Save(""); //get the new id int newID = product.ProductID; product = new Product(newID); product.ReorderLevel = 100; product.Save("unit test"); //pull it out to confirm product = new Product(newID); Assert.IsTrue(product.ReorderLevel == 100, "Bad Save"); Assert.IsTrue(product.SupplierID == null, "Bad Save, Null not inserted"); //delete it ActiveRecord <Product> .Delete(newID); }
/// <summary> /// Deletes a User by their id /// </summary> /// <param name="id">user id</param> /// <returns>true if successfull</returns> public override void Delete(int id) { _userController.Delete(id); _profileController.Delete(id); ActiveRecord <ManagerAssignment> .Delete(ManagerAssignment.Columns.UserID, id); ActiveRecord <ProjectAssignment> .Delete(ProjectAssignment.Columns.UserID, id); }
public void Excluir(int id) { var freteModel = new FreteModel { Id = id.ToString() }; var sql = ActiveRecord.Delete(freteModel); using (var contexto = new Contexto()) { contexto.ExecutaComando(sql); } }