public void ChangeAccountRole(int accountId, Account.AccRole role) { var account = db.Accounts.Where(x => x.Id == accountId).FirstOrDefault(); account.Role = role; db.SaveChanges(); }
public ActionResult ChangeRole(int id, Account.AccRole role) { _repository.ChangeAccountRole(id, role); if (role == Account.AccRole.client) { TempData["ShowSuccessMessage"] = "Darbuotojui sėkmingai panaikinta darbuotojo rolė!"; return(RedirectToAction("EmployeeList")); } else { TempData["ShowSuccessMessage"] = "Klientui sėkmingai suteikta darbuotojo rolė!"; return(RedirectToAction("ClientList")); } }
public ActionResult DeleteAccount(int id, Account.AccRole role) { _repository.DeleteAccount(id); if (role == Account.AccRole.client) { TempData["ShowSuccessMessage"] = "Klientas sėkmingai ištrintas!"; return(RedirectToAction("ClientList")); } else { TempData["ShowSuccessMessage"] = "Darbuotojas sėkmingai ištrintas!"; return(RedirectToAction("EmployeeList")); } }