public IActionResult Create([Bind("BillingID,NameOnCard,CardNumber,SecurityCode,AddressNum,AddressStreet,AddressCity,AddressState,AddressZipCode")] Billing billing, string yearMonth, string num, string zip, string security) { if (yearMonth != null && billing.CardNumber.Length == 16 && int.TryParse(billing.CardNumber.Substring(0, 7), out int cn1) && int.TryParse(billing.CardNumber.Substring(8), out int cn2) && security.Length == 3 && int.TryParse(security, out int s) && int.TryParse(zip, out int z) && zip.Length == 5 && int.TryParse(num, out int n) && num.Length > 0) { billing.AddressNum = int.Parse(num); billing.ExpirationYear = int.Parse(yearMonth.Substring(0, 4)); billing.ExpirationMonth = int.Parse(yearMonth.Substring(5)); billing.SecurityCode = int.Parse(security); billing.AddressZipCode = zip; DatabaseControl.AddNewCardInformationToUser(billing, Storage.GetCustomer(), _context); DatabaseControl.AddNewShippingInformationToUser(billing, Storage.GetCustomer(), _context); List <Billing> cardsOnFile = DatabaseControl.GetCardsOnFileForCustomer(Storage.GetCustomer(), _context); return(View("BillingOptions", cardsOnFile)); } else { ViewData["invalidCard"] = "One or more input parameters were invalid. Please try again."; return(View("Create")); } }