Example #1
0
 public IActionResult ContactInformationForm(CreateContactInformationVM contactInformationVm)
 {
     if (!ModelState.IsValid)
     {
         return(View(contactInformationVm));
     }
     SQLRepository.CreateContactInformation(contactInformationVm.Info, contactInformationVm.SelectedContactValue);
     return(RedirectToAction(nameof(Index)));
 }
Example #2
0
        public IActionResult ContactInformationForm()
        {
            CreateContactInformationVM createContactInformationVm = new CreateContactInformationVM
            {
                ContactItems = SQLRepository.ReadAllContacts()?
                               .Select(c => new SelectListItem
                {
                    Value = c.ID.ToString(),
                    Text  = $"{c.FirstName} {c.LastName}"
                }).ToArray()
            };

            return(View(createContactInformationVm));
        }