public IEnumerable <InstituteDTO> GetAll()
        {
            var institutes = _instituteRepository.Get();

            var mapped = institutes.Select(Mapper.Map <InstituteDTO>).ToList();

            return(mapped);
        }
Example #2
0
        private void ListNobles()
        {
            string text = "";

            Dictionary <int, INoble> .ValueCollection nobles = nobleRepository.GetAll();
            foreach (INoble noble in nobles)
            {
                text += (noble.ID + ". " + noble.Title + " from institute of " + instituteRepository.Get(noble.InstituteId).Name
                         + ", skill " + noble.Skill + ", works published " + noble.WorksPublished + "\n");
            }
            uiFactory.uidialog.ShowMonolog(text);
        }
Example #3
0
        public int Execute()
        {
            IInstitute institute = instituteRepository.Get(instituteId);

            if (institute != null)
            {
                INoble noble = domainFactory.CreateNoble(title, institute.ID);
                nobleRepository.Add(noble);
                noble.AddObserver(nobleObserver);
                nobleId = noble.ID;
                return(0);
            }
            return(1);
        }
Example #4
0
        public int Execute()
        {
            nobles                 = nobleRepository.GetAll();
            oldNobleRepository     = nobleRepository;
            institutes             = instituteRepository.GetAll();
            oldInstituteRepository = instituteRepository;

            foreach (INoble noble in nobles)
            {
                IInstitute institute = instituteRepository.Get(noble.InstituteId);
                while (institute.Influence < noble.Skill)
                {
                    int oldInfluence = institute.Influence;
                    institute.Influence += institute.Influence / 2;
                    noble.Skill         -= oldInfluence;
                    noble.WorksPublished++;
                }
            }
            return(0);
        }
Example #5
0
 public bool CheckIsExist(Institute institute)
 {
     return(instituteRepository.Get(chk => chk.Name == institute.Name) == null ? false : true);
 }