public void AddCategory(Category category) { if (category == null) throw new InvalidOperationException("Categoria inválida"); CategoryId = category.Id; Category = category; }
public Product(string name, decimal price, int quantityOnHand, Category category) { Name = name; Price = price; QuantityOnHand = quantityOnHand; Register(); AddCategory(category); }
public void Update(Category category) { _context.Entry<Category>(category).State = System.Data.Entity.EntityState.Modified; }
public void Save(Category category) { _context.Categories.Add(category); }