public async Task <IActionResult> Create([Bind("CustomerEmail,OrderDate,FullProductCount,TotalPrice,CustomerOrderId,ProductName")] BalloonParty.DataAccess.SQLData.CustomerOrders customerOrders)
        {
            var prodPrices = _context.Products.ToList();

            if (ModelState.IsValid)
            {
                var cso = new BalloonParty.Core.Models.CustomerOrders
                {
                    CustomerEmail    = customerOrders.CustomerEmail,
                    OrderDate        = DateTime.Now,
                    FullProductCount = customerOrders.FullProductCount,
                    TotalPrice       = customerOrders.FullProductCount * prodPrices.SingleOrDefault(p => p.ProductName == customerOrders.ProductName).ProductPrice,
                    CustomerOrderId  = customerOrders.CustomerOrderId,
                    ProductName      = customerOrders.ProductName,
                };

                customerOrders = BalloonParty.DataAccess.Mapper.MapCustomerOrderCORE(cso);
                _context.Add(customerOrders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerEmail"] = new SelectList(_context.Customer, "EmailAddress", "EmailAddress", customerOrders.CustomerEmail);
            ViewData["ProductName"]   = new SelectList(_context.Products, "ProductName", "ProductName", customerOrders.ProductName);
            return(View(customerOrders));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CustomerEmail,OrderDate,FullProductCount,TotalPrice,CustomerOrderId,ProductName")] BalloonParty.DataAccess.SQLData.CustomerOrders customerOrders)
        {
            if (id != customerOrders.CustomerOrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customerOrders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerOrdersExists(customerOrders.CustomerOrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerEmail"] = new SelectList(_context.Customer, "EmailAddress", "EmailAddress", customerOrders.CustomerEmail);
            return(View(customerOrders));
        }