public async Task <IActionResult> ZmienDaneOsobowe(int?id) { if (id == null) { return(NotFound()); } var user = await _userManager.FindByIdAsync(id.ToString()); if (user == null) { return(NotFound()); } var Input = new InputModelChangePersonalData { FirstName = user.imie, LastName = user.nazwisko, Address = user.adres_zamieszkania }; Input.StatusMessage = null; return(View(Input)); }
public async Task <IActionResult> Zarzadzaj() { var user = await _userManager.GetUserAsync(User); var Input = new InputModelChangePersonalData { FirstName = user.imie, LastName = user.nazwisko, Address = user.adres_zamieszkania }; Input.StatusMessage = null; return(View(Input)); }
public async Task <IActionResult> Zarzadzaj([Bind("FirstName,LastName,Address")] InputModelChangePersonalData model) { if (ModelState.IsValid) { var user = await _userManager.GetUserAsync(User); user.imie = model.FirstName; user.nazwisko = model.LastName; user.adres_zamieszkania = model.Address; var result = await _userManager.UpdateAsync(user); if (result.Succeeded) { model.StatusMessage = (string)"Profil został zaktualizowany"; return(View(model)); } } return(View()); }
public async Task <IActionResult> ZmienDaneOsobowe(int id, [Bind("FirstName,LastName,Address")] InputModelChangePersonalData model) { if (ModelState.IsValid) { var user = await _userManager.FindByIdAsync(id.ToString()); if (user == null) { return(NotFound()); } user.imie = model.FirstName; user.nazwisko = model.LastName; user.adres_zamieszkania = model.Address; var result = await _userManager.UpdateAsync(user); if (result.Succeeded) { model.StatusMessage = (string)"Profil został zaktualizowany"; return(View(model)); } } return(View()); }