//GET public ActionResult CreateInit() { var initViewModel = new ContractCreateInitViewModel(); var currentUser = manager.FindById(User.Identity.GetUserId()); string currentName = currentUser.UserName.ToString(); string currentUserId = currentUser.Id.ToString(); ViewBag.OwnerName = currentUserId; string currentDepartmentName = QueryUtility.GetDepartmentsOfUser(currentName, db).Select(d => d.DepartmentName).FirstOrDefault(); ViewBag.ClientSelect = new SelectList(db.Mandants, "Id", "MandantName"); IQueryable <Mandant> currentClient = QueryUtility.GetClientOfDepartment(currentDepartmentName, db); string currentClientName = currentClient.Select(c => c.MandantName).FirstOrDefault(); //ViewBag.CoordinatorId = new SelectList(QueryUtility.GetCoordinatorsFromClient(currentClientName, db), "Id", "UserName"); //ViewBag.ClientId = new SelectList(db.Mandants, "Id", "MandantName"); initViewModel.Coordinators = new SelectList(QueryUtility.GetCoordinatorsFromClient(currentClientName, db), "Id", "UserName"); initViewModel.Signers = new SelectList(db.Users);//Chr: All Users, change Later return(View(initViewModel)); }
//============================================================================== //Json Queries for Javascript Dropdown public ActionResult GetJsonCoordinatorsFromClient(string client) { var data = new SelectList(QueryUtility.GetCoordinatorsFromClient(client, db), "Id", "UserName").ToList(); return(Json(data)); }