public static void DeleteTypeShoes(int typeshoes_id) { TypeShoe typeShoe = Global.ListTypeShoe.Where(t => t.Type_ID == typeshoes_id).SingleOrDefault(); Global.TypeShoesBLL.Delete(typeShoe); Global.ListTypeShoe.Remove(typeShoe); }
public void Delete(TypeShoe typeShoe) { try { using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities()) { Console.WriteLine("Delete(int id)"); typeShoe.Status = 0; myShoeStoreEntities.TypeShoe.AddOrUpdate(typeShoe); if (myShoeStoreEntities.SaveChanges() != 1) { throw new Exception(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public TypeShoe Create(string typeName) { try { using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities()) { Console.WriteLine("Create(string typeName)"); TypeShoe typeShoe = new TypeShoe(); typeShoe.TypeName = typeName; typeShoe.Status = 1; typeShoe = myShoeStoreEntities.TypeShoe.Add(typeShoe); myShoeStoreEntities.SaveChanges(); return(typeShoe); } } catch (Exception ex) { Console.WriteLine(ex.Message); throw; } }
public void AddComboboxTypeShoes(TypeShoe typeShoe) { _cbType.Items.Add(typeShoe); }