public IResult Add(UserOperationClaim userOperationClaim) { var result = _userOperaitonClaimDal.GetAll(u => u.UserId == userOperationClaim.UserId && u.OperationClaimId == userOperationClaim.OperationClaimId); if (result.Count != 0) { return(new ErrorResult(Messages.UserOperationClaimAlreadyExist)); } _userOperaitonClaimDal.Add(userOperationClaim); return(new SuccessResult(Messages.ListedUserOperationClaims)); }
public IDataResult <List <UserOperationClaim> > GetAll() { IResult result = BusinessRule.Run ( _userService.CheckIfUsersExist(), _operationClaimService.CheckIfClaimsExist(), CheckIfUserOperationClaimsExist() ); if (result != null) { return(new ErrorDataResult <List <UserOperationClaim> >(result.Message)); } return(new SuccessDataResult <List <UserOperationClaim> >(_userOperationClaimDal.GetAll())); }
public IResult CheckIfItsAdmin(int userId) { var result = BusinessRules.Run(CheckAdminClaim(userId)); if (result == null) { int adminClaimId = 1; var claims = _userOperationClaimDal.GetAll(u => u.UserId == userId); var adminClaim = claims.SingleOrDefault(c => c.OperationClaimId == adminClaimId); if (adminClaim == null) { return(new ErrorResult()); } return(new SuccessResult()); } return(new ErrorResult(Messages.UserNotFound)); }
public IResult DeleteUserOperationClaimsByUserId(int userId) { var userOperationClaimList = _userOperationClaimDal.GetAll(x => x.UserId == userId); foreach (var userOperationClaim in userOperationClaimList) { _userOperationClaimDal.Delete(userOperationClaim); } ; return(new SuccessResult()); }
public IResult CheckClaimExists(UserOperationClaim userOperationClaim) { var result = _userOperationClaimDal.GetAll(u => u.UserId == userOperationClaim.UserId); foreach (var item in result) { if (item.OperationClaimId == userOperationClaim.OperationClaimId) { return(new ErrorResult(Messages.ClaimAlreadyExists)); } } return(new SuccessResult()); }
public IDataResult <List <UserOperationClaim> > GetAll() { return(new SuccessDataResult <List <UserOperationClaim> >(_userOperationClaimDal.GetAll())); }
public IDataResult <List <UserOperationClaim> > GetAll(Expression <Func <UserOperationClaim, bool> > expression = null) { return(new SuccessDataResult <List <UserOperationClaim> >(_userDal.GetAll(expression).OrderBy(x => x.Id).ToList(), Messages.ItemsListed)); }
public IDataResult <List <UserOperationClaim> > GetAll() { return(new SuccessDataResult <List <UserOperationClaim> >(_userOperationClaimDal.GetAll(), Messages.UsersOperationClaimsListed)); }
public IDataResult <List <UserOperationClaim> > GetAll() { var result = _userOperationClaimDal.GetAll(); return(new SuccessDataResult <List <UserOperationClaim> >(result)); }