Cześć mam prośbe mógby mi ktoś pomoc zrozumieć jak moge edytować profil użytkownika i zmienic jego role mam coś takiego ale wysyakuje mi błąd ze rola nie istnieje
[HttpPost]
public ActionResult Edit(UserEdit model)
{
ApplicationDbContext db = new ApplicationDbContext();
if (!ModelState.IsValid)
{
return View(model);
}
var store = new UserStore<ApplicationUser>(new ApplicationDbContext());
var manager = new UserManager<ApplicationUser>(store);
var currentUser = manager.FindByEmail(model.Email);
currentUser.Email = model.Email;
currentUser.UserName = model.UserName;
currentUser.PhoneNumber = model.Phone;
currentUser.Adress = model.Address;
currentUser.City = model.City;
manager.Update(currentUser);
var ctx = store.Context;
ctx.SaveChanges();
return RedirectToAction("Index", "Home");
}