public IActionResult Create(
            [Bind("Price,CertQty,CustomerName,CustomerEmail,CustomerPhone,StaffName,ChannelName,PromoAmt"
                  )] CertificateCreateViewModel certificateCreateViewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    int result = _context.Database.ExecuteSqlCommand(@"
                    EXEC stpAssignCertificate
                         @customer_name = @customerName
                        ,@customer_email = @customerEmail
                        ,@customer_phone = @customerPhone
                        ,@staff_name = @staffName
                        ,@promo_discount = @promo
                        ,@channel = @channelName
                        ,@cert_price = @price
                        ,@cert_qty = @qty"
                                                                     , new SqlParameter("@customerName", certificateCreateViewModel.CustomerName)
                                                                     , new SqlParameter("@customerEmail", certificateCreateViewModel.CustomerEmail)
                                                                     , new SqlParameter("@customerPhone", certificateCreateViewModel.CustomerPhone)
                                                                     , new SqlParameter("@staffName", certificateCreateViewModel.StaffName)
                                                                     , new SqlParameter("@promo", certificateCreateViewModel.PromoAmt)
                                                                     , new SqlParameter("@channelName", certificateCreateViewModel.ChannelName)
                                                                     , new SqlParameter("@price", certificateCreateViewModel.Price)
                                                                     , new SqlParameter("@qty", certificateCreateViewModel.CertQty)
                                                                     );
                }
                catch (ArgumentNullException) { throw; }

                return(RedirectToAction(nameof(Index)).WithSuccess("Success!", "Certificate(s) issued for " + certificateCreateViewModel.CustomerName));
            }
            return(View(certificateCreateViewModel).WithDanger("Uh-Oh!", "Something went wrong. Try again."));
        }
        // GET: Certificates/Create
        public async Task <IActionResult> Create()
        {
            IEnumerable <SelectListItem> staffNames =
                from staff in await _context.Staff.ToListAsync()
                select new SelectListItem
            {
                Text  = staff.Name,
                Value = staff.Name
            };
            IEnumerable <SelectListItem> channels =
                from channel in await _context.Channel.ToListAsync()
                select new SelectListItem
            {
                Text  = channel.ChannelName,
                Value = channel.ChannelName
            };
            IEnumerable <SelectListItem> promos =
                from promo in await _context.Promotion.ToListAsync()
                select new SelectListItem
            {
                Text  = promo.Discount.ToString("C2"),
                Value = promo.Discount.ToString("D")
            };
            IEnumerable <SelectListItem> customerNames =
                from customer in await _context.Customer.ToListAsync()
                select new SelectListItem
            {
                Text  = customer.Name.ToString(),
                Value = customer.Name.ToString()
            };

            CertificateCreateViewModel model = new CertificateCreateViewModel(
                staffList: staffNames,
                channelList: channels,
                promoList: promos,
                customerNameList: customerNames);

            return(View(model));
        }