public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Phone,Gender,Age,Email,Password,UserType,DateOfBirth,ProfileImage,SecurityQuestionAnswer,SecurityQuestionID,CityID,CountryID")] User user) { if (ModelState.IsValid) { string uniqueFileName = UploadedFile(user); user.ProfilePicture = uniqueFileName; _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CityID"] = new SelectList(_context.City, "Id", "CityName", user.CityID); ViewData["CountryID"] = new SelectList(_context.Country, "Id", "CountryName", user.CountryID); ViewData["SecurityQuestionID"] = new SelectList(_context.SecurityQuestion, "Id", "Question", user.SecurityQuestionID); return(View(user)); }