public IResult Delete(int id)
        {
            var result = _userOperationClaimDal.Get(u => u.Id == id);

            _userOperationClaimDal.Delete(result);
            return(new SuccessResult(Messages.DeletedSuccess));
        }
        public IDataResult <UserOperationClaim> GetById(int id)
        {
            var result = BusinessRules.Run(CheckIfEntityIdValid(id));

            if (result == null)
            {
                return(new SuccessDataResult <UserOperationClaim>(_userOperationClaimDal.Get(c => c.Id == id), BusinessMessages.UserOperationClaimDetailsListed));
            }

            return(new ErrorDataResult <UserOperationClaim>());
        }
        public IDataResult <UserOperationClaim> GetById(int id)
        {
            var     selectedUserOperationClaim = _userOperationClaimDal.Get(uoc => uoc.Id == id);
            IResult result = BusinessRule.Run
                                 (_userService.CheckIfUserExist(selectedUserOperationClaim.UserId),
                                 _operationClaimService.CheckIfClaimExist(selectedUserOperationClaim.OperationClaimId),
                                 CheckIfUserOperationClaimExist(id)
                                 );

            if (result != null)
            {
                return(new ErrorDataResult <UserOperationClaim>(result.Message));
            }

            return(new SuccessDataResult <UserOperationClaim>(_userOperationClaimDal.Get(uoc => uoc.Id == id)));
        }
        private IResult CheckUserHasOperationClaim(UserOperationClaim userOperationClaim)
        {
            var result = _userOperationClaimDal.Get(o => o.OperationClaimID == userOperationClaim.OperationClaimID);

            if (result != null)
            {
                if (result.UserOperationClaimID != userOperationClaim.UserOperationClaimID)
                {
                    return(new ErrorResult(Messages.UserHasAlreadyOperationClaim));
                }
            }
            return(new SuccessResult());
        }
 public IDataResult <UserOperationClaim> GetById(int id)
 {
     return(new SuccessDataResult <UserOperationClaim>(_userOperationClaimDal.Get(u => u.Id == id)));
 }
 public IDataResult <UserOperationClaim> GetById(int id)
 {
     return(new SuccessDataResult <UserOperationClaim>(_userDal.Get(x => x.Id == id), Messages.ItemGetted));
 }
Ejemplo n.º 7
0
 public IDataResult <UserOperationClaim> GetClaimByUserId(int userId)
 {
     return(new SuccessDataResult <UserOperationClaim>(_userOperationClaimDal.Get(claim => claim.UserId == userId)));
 }
        public IDataResult <UserOperationClaim> GetById(int id)
        {
            var result = _userOperationClaimDal.Get(uoc => uoc.Id == id);

            return(new SuccessDataResult <UserOperationClaim>(result, Messages.UserOperationClaim.GetByIdSuccess));
        }
 public IResult Delete(int Id)
 {
     _userOperationClaimDal.Delete(_userOperationClaimDal.Get(p => p.Id == Id));
     return(new SuccessResult(Messages.UserOperationClaimDeleted));
 }