public async Task <IActionResult> Edit(int id, [Bind("UserMain")] EventRegistrationVM eventRegistrationVM)
        {
            if (id != eventRegistrationVM.UserMain.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eventRegistrationVM.UserMain);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserMainExists(eventRegistrationVM.UserMain.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(eventRegistrationVM));
        }
        public async Task <IActionResult> Create([Bind("UserMain")] EventRegistrationVM eventRegistrationVM)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eventRegistrationVM.UserMain);
                await _context.SaveChangesAsync();

                int ID = eventRegistrationVM.UserMain.ID;
                CS.MailSend(eventRegistrationVM.UserMain.Email, ID, "CSV"); // pass the csv file

                return(RedirectToAction(nameof(Index)));
            }
            await FillDropdown(eventRegistrationVM);

            return(View(eventRegistrationVM));
        }
        private async Task FillDropdown(EventRegistrationVM VM)
        {
            VM.HallDetailList = await _context.HallDetail?.Select(s => new SelectListItem
            {
                Value = s.ID.ToString(),
                Text  = s.Name
            }).ToListAsync();

            VM.EventTypeList = await _context.EventType?.Select(s => new SelectListItem
            {
                Value = s.ID.ToString(),
                Text  = s.Type
            }).ToListAsync();

            VM.EventSetupList = await _context.EventSetup?.Select(s => new SelectListItem
            {
                Value = s.ID.ToString(),
                Text  = s.SetUp
            }).ToListAsync();
        }