public static Bakery UpdateBakery(Bakery updatedBakery) { var oldBakery = GetBakeryOrderByCustomerNumber(updatedBakery.CustomerNumber); oldBakery.CustomerEmailAddress = updatedBakery.CustomerEmailAddress; oldBakery.BakeryProduct = updatedBakery.BakeryProduct; db.SaveChanges(); return(oldBakery); }
public static void Order(int customerNumber, int NumberOfOrder) { Bakery bakery = GetBakeryOrderByCustomerNumber(customerNumber); bakery.Order(NumberOfOrder); var transaction = new Transaction { TransactionDate = DateTime.Now, TransactionType = TransactionType.Credit, Description = "Bakery order", NumberOfOrder = NumberOfOrder, CustomerNumber = customerNumber }; db.Transactions.Add(transaction); db.SaveChanges(); }