/*<summary>
         * creates pitStop
         *  </summary>
         *  <returns>
         *  dialog View of the pitStop creation
         * </returns>*/
        public ActionResult CreatePitStop()
        {
            TARDBContext          userList    = new TARDBContext();
            List <SelectListItem> ListOfUsers = new List <SelectListItem>();

            var getRole       = (from r in db.Roles where r.Name.Contains("Staff") select r).FirstOrDefault();
            var getStaffUsers = db.Users.Where(x => x.Roles.Select(y => y.RoleId).Contains(getRole.Id)).ToList();

            foreach (var item in getStaffUsers)
            {
                ListOfUsers.Add(new SelectListItem()
                {
                    Text = item.UserName, Value = item.UserName
                });
            }
            ViewBag.StaffList = ListOfUsers;

            return(PartialView("_CreatePitStop"));
        }
Ejemplo n.º 2
0
 public UOW()
 {
     _context = new TARDBContext();
 }
 public TeamRepository(TARDBContext context) : base(context)
 {
 }
 /// <summary>
 ///  Public Constructor,initializes privately declared local variables.
 /// </summary>
 /// <param name="context"></param>
 public GenericRepository(TARDBContext context)
 {
     this.Context = context;
     this.DbSet   = context.Set <TEntity>();
 }