Пример #1
0
        public IDataResult <List <WorkerDetailsDto> > GetAllManagers()
        {
            try
            {
                var managerRoles = _userRoleDal.GetList(ur => ur.RoleId == 3);
                var allManagers  = new List <Worker>();
                var userDetails  = new List <User>();
                foreach (var managerRole in managerRoles)
                {
                    allManagers.Add(_workerDal.Get(w => w.WorkerId == managerRole.UserId));
                    userDetails.Add(_userDal.Get(u => u.Id == managerRole.UserId));
                }

                List <WorkerDetailsDto> workers = new List <WorkerDetailsDto>();
                foreach (var manager in allManagers)
                {
                    var user = userDetails.SingleOrDefault(u => u.Id == manager.WorkerId);
                    workers.Add(new WorkerDetailsDto
                    {
                        FirstName     = user.FirstName,
                        LastName      = user.LastName,
                        AddressNumber = manager.AddressNumber,
                        BirthDate     = manager.BirthDate,
                        CityId        = manager.CityId,
                        CityName      = _cityService.GetCityById(manager.CityId).Data.CityName,
                        DistrictId    = manager.DistrictId,
                        DistrictName  = _cityService.GetDistrictById(manager.DistrictId).Data.DistrictName,
                        Email         = user.Email,
                        GenderId      = user.GenderId,
                        PhoneNumber   = user.PhoneNumber,
                        GenderName    = _genderDal.Get(g => g.GenderId == user.GenderId).GenderName,
                        HireDate      = manager.HireDate,
                        QuitDate      = manager.QuitDate,
                        IdentityNo    = manager.IdentityNo,
                        Street        = manager.Street,
                        WorkerId      = manager.WorkerId
                    });
                }
                return(new SuccessDataResult <List <WorkerDetailsDto> >(workers));
            }
            catch (Exception e)
            {
                return(new ErrorDataResult <List <WorkerDetailsDto> >(Messages.ErrorWhileGettingEntity));
            }
        }
Пример #2
0
        public IDataResult <List <User> > GetAllCustomers()
        {
            try
            {
                var userRoleList = _userRoleDal.GetList(ur => ur.RoleId == 1);

                var customerList = new List <User>();

                foreach (var userRole in userRoleList)
                {
                    customerList.Add(GetById(userRole.UserId).Data);
                }

                return(new SuccessDataResult <List <User> >(customerList));
            }
            catch (Exception)
            {
                return(new ErrorDataResult <List <User> >(Messages.ErrorWhileGettingEntity));
            }
        }
Пример #3
0
 // [PerformanceCounterAspect(1)]
 public List <UserRole> GetAll()
 {
     return(_userRoleDal.GetList());
 }
Пример #4
0
 //[SecuredOperation(Roles="Admin,Editor,Student")]
 public List <UserRole> GetList()
 {
     //Thread.Sleep(3000);    //performanscounterı test için yazıldı
     return(_userRoleDal.GetList());
 }
Пример #5
0
        public List <UserRole> GetAll()
        {
            var data = _mapper.Map <List <UserRole> >(_userRoleDal.GetList());

            return(data);
        }