public ActionResult Index() { CarsViewModel model = new CarsViewModel(); model.IsAdministrator = IsAdministrator(); DatabaseControler dc = new DatabaseControler(); var userName = User.Identity.Name; ApplicationUserManager userManager = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); var user = userManager.FindByName(userName); model.IsSetCompany = dc.IsSetCompany(user.Id); model.CarList = dc.GetAllCars(user); return View(model); }
// GET: Drivers cała lista kierowców public ActionResult Index() { DatabaseControler dc = new DatabaseControler(); var userName = User.Identity.Name; ApplicationUserManager userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(); var user = userManager.FindByName(userName); if (!IsAdministrator(user.Id)) { RedirectToAction("Index", "Home"); } var drivers = dc.GetAllUsers(user); DriversViewModels model = new DriversViewModels(); model.Drivers = drivers; model.IsSetCompany = dc.IsSetCompany(user.Id); return(View(model)); }