Пример #1
0
        public void AddCategory(Category category)
        {
            if (category == null)
                throw new InvalidOperationException("Categoria inválida");

            CategoryId = category.Id;
            Category = category;
        }
Пример #2
0
        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);
 }