// GET: Users/Create public ActionResult Create() { var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); if (user == null) { return(RedirectToAction("Index", "Home")); } var userlog = new UserView { CompanyId = user.CompanyId }; ViewBag.DepartmentId = new SelectList(CombosHelper.GetDepartments(), "DepartmentId", "Name"); ViewBag.DistrictId = new SelectList(CombosHelper.GetDistricts(), "DistrictId", "Name"); ViewBag.MainWarehouseId = new SelectList(CombosHelper.GetMainWarehouses(user.CompanyId), "MainWarehouseId", "Name"); ViewBag.userRoles = SelectUserRolers(); return(View(userlog)); }