public IActionResult SelectCustomer(MultipleInputCustomersAndDemographics model)
        {
            string selectedCustomerId = model.multipleDemographics.selectedCustomerId;

            if (selectedCustomerId != null)
            {
                model.multipleDemographics.customersInDatabase.Find(x => x.Value.Equals(selectedCustomerId)).Selected = true;
            }
            return(View(nameof(Index), model));
        }
        public IActionResult ChooseView(MultipleInputCustomersAndDemographics aaa)
        {
            if (aaa.createCustomers == 1)
            {
                aaa.multipleCustomers.demographicsInDatabase = _context.CustomerDemographics.Select(x => new SelectListItem(x.CustomerDesc, x.CustomerTypeId.ToString())).ToList();;
            }
            else if (aaa.createCustomers == 2)
            {
                aaa.multipleDemographics.customersInDatabase = _context.Customers.Select(x => new SelectListItem(x.CompanyName, x.CustomerId)).ToList();
            }

            return(View(nameof(Index), aaa));
        }
        public IActionResult BatchCreateCustomers(MultipleInputCustomersAndDemographics model)
        {
            if (ModelState.IsValid)
            {
                string selectedDemographicId            = model.multipleCustomers.selectedDemographicId;
                CustomerDemographic customerDemographic = _context.CustomerDemographics.Find(selectedDemographicId);
                List <Customer>     newCustomers        = model.multipleCustomers.newCustomers;
                customerService.batchCreate(newCustomers, customerDemographic, _context);

                model.multipleCustomers = new MultipleCustomers();
                model.createCustomers   = 0;
                return(View(nameof(Index), model));
            }
            return(View(nameof(Index), model));
        }
 public IActionResult CreateCustomer([Bind("CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax")] Customer customer, MultipleInputCustomersAndDemographics aaa)
 {
     if (ModelState.IsValid)
     {
         aaa.multipleCustomers.newCustomers.Add(customer);
         aaa.multipleCustomers.newCustomer = null;
         return(View(nameof(Index), aaa));
     }
     else
     {
         aaa.multipleCustomers.newCustomer = customer;
     }
     return(View(nameof(Index), aaa));
 }
 //GET
 public IActionResult CreateCustomer(MultipleInputCustomersAndDemographics aaa)
 {
     aaa.multipleCustomers.newCustomer = new Customer();
     return(View(nameof(Index), aaa));
 }
        // GET: MultipleInputCustomersAndDemographicsController
        public ActionResult Index()
        {
            MultipleInputCustomersAndDemographics model = new MultipleInputCustomersAndDemographics();

            return(base.View(model));
        }
 public IActionResult CreateDemographic([Bind("CustomerDesc")] CustomerDemographic customerDemographic, MultipleInputCustomersAndDemographics aaa)
 {
     if (ModelState.IsValid)
     {
         aaa.multipleDemographics.newDemographics.Add(customerDemographic);
         aaa.multipleDemographics.newDemographic = null;
         return(View(nameof(Index), aaa));
     }
     else
     {
         aaa.multipleDemographics.newDemographic = customerDemographic;
     }
     return(View(nameof(Index), aaa));
 }