public async Task <IActionResult> Index(string username, int locationZip) { var existProfile = await _context.GetProfile(username); if (existProfile == null) { Profile profile = new Profile(); profile.Username = username; profile.LocationZip = locationZip; await _context.CreateProfile(profile); HttpContext.Session.SetString("profile", JsonConvert.SerializeObject(profile)); //Session["profile"] = profile; if (profile != null) { return(RedirectToAction("Index", "Pet")); } } var error = new RegisterError(); error.userExist = true; return(View(error)); }
public async Task <IActionResult> Index(string username) { Profile profile = await _context.GetProfile(username); HttpContext.Session.SetString("profile", JsonConvert.SerializeObject(profile)); //Session["profile"] = profile; if (profile != null) { return(RedirectToAction("Index", "Pet")); } else { return(View()); } }