Example #1
0
        public bool AddNewRole(Role role)
        {
            if (_rolesDao.GetAll().Any(item => item.Title == role.Title))
            {
                return(false);
            }

            _rolesDao.Add(role);
            return(true);
        }
Example #2
0
        public bool SignIn(string login, string password)
        {
            var user = _userDao.GetAll().FirstOrDefault(item => item.Name == login);

            if (user is null)
            {
                return(false);
            }

            return(password == _authUserDataDao.GetAll()
                   .FirstOrDefault(item => item.UserId == user.Id).Password);
        }
Example #3
0
        public IEnumerable <TAssociatedEntity> GetAssociatedEntities(int entityId)
        {
            var document = XDocument.Load(_storageFileInfo.FullName);

            var associationsIdSet = (from element in document.Root.Elements()
                                     let association = element.FromXElement <XmlAssociationEntity>()
                                                       let match = _isInverted ? association.SecondEntityId : association.FirstEntityId
                                                                   let associatedId = _isInverted ? association.FirstEntityId : association.SecondEntityId
                                                                                      where match == entityId
                                                                                      select associatedId).ToHashSet();

            return(_associatedEntityWithIdDao.GetAll()
                   .Where(entity => associationsIdSet.Contains(entity.Id)));
        }
Example #4
0
 public IEnumerable <Award> GetAllAwards() => _awardsDao.GetAll();
Example #5
0
 public IEnumerable <User> GetAllUsers() => _usersDao.GetAll();