public IActionResult Edit(int id, [Bind("CustomerNumber, BakeryProduct,CustomerName,CustomerEmailAddress,NumberOfOrder")] Bakery bakery)
        {
            if (id != bakery.CustomerNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    BakeryOrder.UpdateBakery(bakery);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (BakeryOrder.GetBakeryOrderByCustomerNumber(bakery.CustomerNumber) == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bakery));
        }
        public IActionResult Order(IFormCollection controls)
        {
            var accountNumber = Convert.ToInt32(controls["CustomerNumber"]);
            var numberOfOrder = Convert.ToInt32(controls["numberOfOrder"]);

            BakeryOrder.Order(accountNumber, numberOfOrder);
            return(RedirectToAction(nameof(Index)));
        }
 public IActionResult Create([Bind("BakeryProduct,CustomerName,CustomerEmailAddress,NumberOfOrder")] Bakery bakery)
 {
     if (ModelState.IsValid)
     {
         BakeryOrder.CreateBakery(bakery.BakeryProduct, bakery.CustomerName, bakery.CustomerEmailAddress, bakery.CustomerBankAccountNumber, bakery.NumberOfOrder);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(bakery));
 }
        public IActionResult Transaction(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var transaction = BakeryOrder.GetTransactionsForCustomerNumber(id.Value);

            return(View(transaction));
        }
        // GET: Bakeries
        public IActionResult Index()

        {
            if (HttpContext != null &&
                !string.IsNullOrEmpty
                    (HttpContext.User.Identity.Name))
            {
                UserName = HttpContext.User.Identity.Name;
            }
            return(View(BakeryOrder.GetBakeryOrderForUser(UserName)));
        }
        // GET: Bakeries/Edit/5
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var bakery = BakeryOrder.GetBakeryOrderByCustomerNumber(id.Value);

            if (bakery == null)
            {
                return(NotFound());
            }
            return(View(bakery));
        }
        public IActionResult Order(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var account = BakeryOrder.GetBakeryOrderByCustomerNumber(id.Value);

            if (account == null)
            {
                return(NotFound());
            }
            string bakery = null;

            return(View(bakery));
        }