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)); } }
public UserRole GetById(int userRoleId) { return(_userRoleDal.Get(u => u.UserRoleId == userRoleId)); }
public UserRole GetById(int userRoleId) { return(_userRoleDal.Get(x => x.Id == userRoleId)); }
public UserRole Get(int id) { return(_userRoleDal.Get(x => x.Id == id)); }
public UserRole Find(Expression <Func <UserRole, bool> > filter) { var data = _mapper.Map <UserRole>(_userRoleDal.Get(filter)); return(data); }
public UserRole GetById(Guid id) { return(_userroleDal.Get(h => h.Id == id)); }