コード例 #1
0
ファイル: WorkerManager.cs プロジェクト: war-man/ETrade
        public IResult AddWorker(Worker worker)
        {
            try
            {
                worker.HireDate = DateTime.Now;
                worker.QuitDate = new DateTime(1900, 01, 01, 0, 0, 0);
                _workerDal.Add(worker);

                var userRole = new UserRole
                {
                    RoleId = 2, //worker rolü
                    UserId = worker.WorkerId
                };
                var oldRole = _userRoleDal.Get(ur => ur.UserId == worker.WorkerId);
                _userRoleDal.Delete(oldRole);
                _userRoleDal.Add(userRole);
                return(new SuccessResult());
            }
            catch (Exception)
            {
                return(new ErrorResult(Messages.ErrorWhileAddingEntity));
            }
        }
コード例 #2
0
 public UserRole GetById(int userRoleId)
 {
     return(_userRoleDal.Get(u => u.UserRoleId == userRoleId));
 }
コード例 #3
0
 public UserRole GetById(int userRoleId)
 {
     return(_userRoleDal.Get(x => x.Id == userRoleId));
 }
コード例 #4
0
 public UserRole Get(int id)
 {
     return(_userRoleDal.Get(x => x.Id == id));
 }
コード例 #5
0
        public UserRole Find(Expression <Func <UserRole, bool> > filter)
        {
            var data = _mapper.Map <UserRole>(_userRoleDal.Get(filter));

            return(data);
        }
コード例 #6
0
 public UserRole GetById(Guid id)
 {
     return(_userroleDal.Get(h => h.Id == id));
 }