Пример #1
0
 public void Publish(Article article)
 {
     article.PostedDate  = DateTime.Now;
     article.Disciplines = disciplineStorage.Get(
         article.Disciplines.Select(x => x.Id)).ToList();
     articleStorage.Add(article);
 }
Пример #2
0
 public void Ask(Question question)
 {
     question.Disciplines = disciplineStorage.Get(
         question.Disciplines.Select(x => x.Id)).ToList();
     question.PostedDate = DateTime.Now;
     questionStorage.Add(question);
 }
Пример #3
0
 private static IEnumerable<Discipline> SelectDisciplines(
     IDisciplineStorage storage)
 {
     yield return storage.Get(2);
     yield return storage.Get(5);
     yield return storage.Get(3);
     yield return storage.Get(8);
     yield return storage.Get(4);
     yield return storage.Get(11);
     yield return storage.Get(14);
 }
Пример #4
0
        private static IEnumerable <Discipline> SelectDisciplines(
            IDisciplineStorage storage)
        {
            yield return(storage.Get(2));

            yield return(storage.Get(5));

            yield return(storage.Get(3));

            yield return(storage.Get(8));

            yield return(storage.Get(4));

            yield return(storage.Get(11));

            yield return(storage.Get(14));
        }
Пример #5
0
        public void Subscribe(int userId, IEnumerable <int> disciplineIds)
        {
            var disciplines = disciplineStorage.Get(disciplineIds);

            userStorage.UpdateDisciplines(userId, disciplines.Select(x => x.Id));
        }