// GET: Employee public ActionResult Index() { List <Employee> empList = new List <Employee>(); empList = empRepo.GetAllItems(); return(View(empRepo.GetAllItems())); }
public IEnumerable <ScheduleModel> ScheduleSearch(DateTime date, Guid classId) { var models = _repoSched.GetAllItems() .Where(x => x.ClassId == classId && date.Date == x.Date.Date) .Select(GetScheduleModel) .ToList(); return(models); }
public void CreatePropertyValue(string propName, string value, Guid entityId) { var prop = _repoProps.GetAllItems().FirstOrDefault(x => x.Name == propName); var propValue = Activator.CreateInstance <PropertyValue>(); propValue.EntityId = entityId; propValue.PropertyId = prop.Id; propValue.Id = new Guid(); propValue.Value = value; _repoPropVal.Create(propValue); }
public IEnumerable <SpaModel> GetMany(Guid schedId) { var sps = _spRepo.GetAllItems(x => x.ScheduleId == schedId); var entities = _spaRepo .GetAllItems(x => sps.Select(z => z.Id).Contains(x.SpecialTaskId)); var models = entities .Select(_mapper.Map <SpaEntity, SpaModel>) .ToList(); foreach (var model in models) { model.Student = _studentService.GetStudentModel(model.StudentId); } return(models); }
// GET: Department public ActionResult Index() { List <Department> deptList = new List <Department>(); deptList = deptRepo.GetAllItems(); return(View(deptList)); }
public Task <IEnumerable <PersonDTO> > Handle(GetAllPersons getAllPersons, CancellationToken cancellationToken) { var personsList = _personRepository.GetAllItems().ToList(); var personDTOList = personsList.Select(a => _mapper.Map <Person, PersonDTO>(a)); return(Task.FromResult(personDTOList)); }
public string RunCommand(string item, string userID) { ApplicationUser user = repos.GetUser(userID); users = repos.GetAllUsers(); List <Item> items = repos.GetAllItems(); for (int j = 0; j < users.Count; j++) { ApplicationUser players = users[j]; if (players.FirstName.Equals(item) || players.FirstName.ToLower().Equals(item)) { if (user.Room.Id == players.Room.Id) { return("You just punched " + players.FirstName + " in the " + vitals.ElementAt(rand.Next(0, 7))); } } } for (int i = 0; i < items.Count; i++) { Item it = items[i]; if (user.Room.Id == it.Room.Id) { if (item == it.Name.ToLower() || item == it.Name) { return("You just struck a " + it.Name); } } } return("The Item/Person you are trying to hit/struck does not exist in this room"); }
public IEnumerable <ClassModel> GetClasses() { var entities = _repoClass.GetAllItems(); var models = entities.Select(entity => GetClassModel(entity)) .OrderBy(x => x.FullName); return(models); }
public IList <string> GetAllItems() { var items = _repository.GetAllItems(); return(items .Select(item => item.Trim()) .ToList()); }
public ProductsViewModel(IPageService pageService, IRepository <ObservableCollection <ProductViewModel> > repository) { _pageService = pageService; _repository = repository; SelectProductCommand = new Command <ProductViewModel>(async(viewModel) => await SelectProduct(viewModel)); Products = _repository.GetAllItems(); }
/// <summary> /// Get the list of items from repository /// </summary> /// <returns>The list of items is class T</returns> public IEnumerable <T> GetAllItems() { var list = data.GetAllItems(); if (list == null) { return(new List <T>()); } return(list); }
// GET: Admin public IActionResult Index() { AdminIndexViewModel model = new AdminIndexViewModel() { Pies = _pieRepo.GetAllPies(), SubmittedOrders = _orderRepo.GetAllItems() }; return(View(model)); }
public IActionResult LessonEdit(Guid id, Guid classId, int year, int month, int day, int hour, int min) { var dateTime = new DateTime(year, month, day, hour, min, 0); var schedModel = _scheduleService.GetSchedule(id); var viewModel = new LessonEditModel(); viewModel.DateTime = dateTime; viewModel.ClassId = schedModel != null? schedModel.Class.Id : classId; viewModel.Classes = _classService.GetClasses().ToDictionary(x => x.Id, y => y.FullName); viewModel.TeacherId = schedModel == null ? Guid.Empty : schedModel.Teacher.Id; viewModel.TeacherName = schedModel == null ? string.Empty : schedModel.Teacher.Name; viewModel.Subjects = _repoSubject.GetAllItems().ToDictionary(x => x.Id, y => y.Name); viewModel.SubjectId = schedModel == null ? Guid.Empty : viewModel.Subjects.FirstOrDefault(x => x.Value == schedModel.Subject).Key; viewModel.Id = schedModel == null ? Guid.Empty: schedModel.Id; return(View(viewModel)); }
public OrganizationsController(IRepository <Organization> context) { this.db = context; if (!db.GetAllItems().Any()) { db.Create(new Organization { Name = "Tom", Code = 5, Id = 4, Owner = "4f", Type = Types.Inc }); } }
public UserController(IRepository <User> context) { this.db = context; if (!db.GetAllItems().Any()) { db.Create(new User { Name = "Tom", SurName = "Lol", Email = "wrg", Adress = "df" }); } }
Task <Item[]> GetAllItems(Guid playerId) { try { return(_repoManager.GetAllItems(playerId)); } catch (System.Exception) { throw new NotFoundException(); } }
public string GetGeneratedLogin(string role) { var existedIndexes = _userRepo .GetAllItems() .Where(user => user.Login.ToLower().Contains(role.ToLower())) .Select(user => new Regex("[0-9]+").Match(user.Login).Value). ToList(); if (!existedIndexes.Any()) { return($"{role}1"); } var maxIndex = existedIndexes .Select(strIndex => int.Parse(strIndex)) .OrderByDescending(index => index) .FirstOrDefault(); return($"{role}{++maxIndex}"); }
public IEnumerable <UserDetail> GetAllUsers() { return(_userRepository.GetAllItems() .Select(i => { return new UserDetail { Email = i.Email, Id = i.Id, IsActive = i.IsActive }; })); }
public IEnumerable <MessageDetail> GetAllMessages() { return(_messageRepository.GetAllItems() .Select(i => new MessageDetail { By = i.By, Id = i.Id, Likes = i.Likes, On = i.On, Text = i.Text }) .OrderByDescending(i => i.On)); }
public void InitTable() { var collection = new List <Profile>(_repository.GetAllItems().Where(p => p.User_Id == App.UserLogin)); if (_profileSort.SaveSelectSort == null || _profileSort.SaveSelectSort == "By date") { var sortCollection = from p in collection orderby p.DateTimePr select p; ProfileCollection = new ObservableCollection <Profile>(sortCollection); } if (_profileSort.SaveSelectSort == "By name") { var sortCollection = from p in collection orderby p.Name select p; ProfileCollection = new ObservableCollection <Profile>(sortCollection); } if (_profileSort.SaveSelectSort == "By nick name") { var sortCollection = from p in collection orderby p.NickName select p; ProfileCollection = new ObservableCollection <Profile>(sortCollection); } LableText = ProfileCollection.Count == 0 ? AppResources.LableMainList : string.Empty; }
public IEnumerable <CatalogueDetail> GetAllCatalogues() { return(_catalogueRepository.GetAllItems() .Select(i => { return new CatalogueDetail { CatalogueList = i.CatalogueList, Id = i.Id, IsActive = i.IsActive, Type = i.Type }; })); }
/// <summary> /// Retrieves all the instances of the model from the repository /// </summary> /// <returns></returns> public virtual IList GetAllItems(IActionContext ctx) { IList items = null; try { items = _repository.GetAllItems(); } catch (Exception ex) { string error = "Unable to retrieve all items of type " + typeof(T).Name; ErrorManager.Handle(error, ex, ctx.Errors); } return(items); }
private IEnumerable <ScheduleModel> GetStudentScheduleByDay(DateTime day, Guid entityId) { var classId = _repoClassStudentRelationship.GetAllItems().FirstOrDefault(x => x.StudentId == entityId)?.ClassId; if (classId == null) { return(null); } var schedules = _repoSched.GetAllItems() .Where(x => x.ClassId == classId && x.Date.Date == day.Date) .Select(GetScheduleModel) .OrderBy(x => x.Date).ToList(); return(schedules); }
public IEnumerable<UserDetail> GetAllUsers() { return _userRepository.GetAllItems() .Select(i => { return new UserDetail { Email = i.Email, Name = i.Name, IsReset = i.IsReset, ResetKey = i.ResetKey, Id = i.Id, IsActive = i.IsActive }; }); }
private ClassModel GetClassModel(Class classEntity) { var classModel = _mapper.Map <Class, ClassModel>(classEntity); var studentIds = _repoClassStudents .GetAllItems() .Where(x => x.ClassId == classEntity.Id) .Select(x => x.StudentId) .ToList(); foreach (var studentId in studentIds) { var student = GetUser(studentId); classModel.Students.Add(student); } return(classModel); }
public void UpdateSchedule(ScheduleModel model) { var scheduleEntity = Activator.CreateInstance <Schedule>(); scheduleEntity.Id = model.Id; scheduleEntity.Date = model.Date; scheduleEntity.ClassId = model.Class.Id; scheduleEntity.TeacherId = model.Teacher.Id; scheduleEntity.SubjectId = _repoSubject.GetAllItems().FirstOrDefault(x => x.Name == model.Subject).Id; if (model.Id == Guid.Empty) { _repoSched.Create(scheduleEntity); } else { _repoSched.Update(scheduleEntity); } }
public IEnumerable <User> Get() { return(db.GetAllItems()); }
public Task <Item[]> GetAllItems(Guid playerId) { return(_repository.GetAllItems(playerId)); }
// [Route("{playerId:Guid}")] public async Task <Item[]> GetAllItems(Guid playerId) { return(await _repository.GetAllItems(playerId)); }
public async Task <Item[]> GetAllItems(Guid playerId) { Item[] items = await _irep.GetAllItems(playerId); return(items); }
public EditorViewModel(IRepository<Quiz> quizRepo, IRepository<Category> categoryRepo, IRepository<Question> questionRepo, INotificationService notificationService, IWindowService windowService) { _windowService = windowService; _notificationService = notificationService; _quizRepo = quizRepo; _questionRepo = questionRepo; _categoryRepo = categoryRepo; AllQuizes = new ObservableCollection<QuizViewModel>(); AllQuestions = new ObservableCollection<QuestionViewModel>(); AllCategories = new ObservableCollection<CategoryViewModel>(); notificationService.OnStartedLoading += NotificationService_OnLoadingChanged; notificationService.OnStoppedLoading += NotificationService_OnLoadingChanged; notificationService.OnNewDisplayMessage += NotificationService_OnNewDisplayMessage; notificationService.OnMessageReceived += NotificationService_OnMessageReceived; LoadingVisibility = Visibility.Hidden; NotificationVisibility = Visibility.Hidden; RemoveQuizCommand = new RelayCommand(OnRemoveQuiz, CanRemoveQuiz); AddQuizCommand = new RelayCommand(OnAddQuiz); RemoveQuestionCommand = new RelayCommand(OnRemoveQuestion, CanRemoveQuestion); AddQuestionCommand = new RelayCommand(OnAddQuestion); AddAnswerCommand = new RelayCommand(OnAddAnwer, CanAddAnswer); RemoveAnswerCommand = new RelayCommand(OnRemoveAnswer, CanRemoveAnswer); SaveQuestionCommand = new RelayCommand(OnSaveQuestion, CanSaveQuestion); CloseNotificationCommand = new RelayCommand(OnCloseNotification); Task.Run(() => { DispatcherHelper.CheckBeginInvokeOnUI(() => { LoadingVisibility = Visibility.Visible; }); var allQuizes = new List<QuizViewModel>(); var allQuestions = new List<QuestionViewModel>(); var allCategories = new List<CategoryViewModel>(); foreach (var quiz in _quizRepo.GetAllItems()) { allQuizes.Add(new QuizViewModel(quiz, _quizRepo, _questionRepo, _categoryRepo, notificationService)); } foreach (var question in _questionRepo.GetAllItems()) { allQuestions.Add(new QuestionViewModel(question, _questionRepo, _categoryRepo, _notificationService)); } foreach (var categorie in _categoryRepo.GetAllItems()) { allCategories.Add(new CategoryViewModel(categorie, _categoryRepo, _notificationService)); } DispatcherHelper.CheckBeginInvokeOnUI(() => { allQuizes.ForEach(q => AllQuizes.Add(q)); allQuestions.ForEach(q => AllQuestions.Add(q)); allCategories.ForEach(c => AllCategories.Add(c)); RaisePropertyChanged("AllQuizes"); RaisePropertyChanged("AllQuestions"); RaisePropertyChanged("AllCategories"); LoadingVisibility = Visibility.Hidden; }); }); SelectedQuiz = new QuizViewModel(new Quiz() { Questions = new List<QuizQuestion>() }, _quizRepo, _questionRepo, _categoryRepo, notificationService); SelectedQuestion = new QuestionViewModel(new Question() { Answers = new List<Answer>(), Category = new Category() }, _questionRepo, _categoryRepo, _notificationService); NewCategory = new CategoryViewModel(new Category(), _categoryRepo, _notificationService); //SelectedTabIndex = 1; }
public static ThemeClassificationEntity GetThemeClassificationEntityByTitle(IRepository<ThemeClassificationEntity> repository, string title) { return repository.GetAllItems<ThemeClassificationEntity>().FirstOrDefault(e => e.Title == title); }