public async Task <IResult> Handle(DeleteOperationClaimCommand request, CancellationToken cancellationToken) { var claimToDelete = await _operationClaimDal.GetAsync(x => x.Id == request.Id); await _operationClaimDal.DeleteAsync(claimToDelete); return(new SuccessResult(Messages.OperationClaimDeleted)); }
public async Task <IResult> Register(User user) { await _userDal.AddAsync(user); var defaultOperationClaim = await _operationClaimDal.GetAsync(o => o.Name == "user"); if (defaultOperationClaim is null) { defaultOperationClaim = new OperationClaim { Name = "user" }; await _operationClaimDal.AddAsync(defaultOperationClaim); } await _userOperationClaimDal.AddAsync(new UserOperationClaim { UserId = user.Id, OperationClaimId = defaultOperationClaim.Id }); return(new SuccessResult(Messages.UserCreated)); }
public async Task <IDataResult <OperationClaim> > Handle(GetOperationClaimQuery request, CancellationToken cancellationToken) { return(new SuccessDataResult <OperationClaim>(await _operationClaimDal.GetAsync(x => x.Id == request.Id))); }
public async Task <IDataResult <OperationClaim> > Get(string id) { return(new SuccessDataResult <OperationClaim>(await _operationClaimDal.GetAsync(o => o.Id == id))); }
public async Task <IDataResult <OperationClaim> > GetByIdAsync(int id) { var result = await _operationClaimDal.GetAsync(op => op.Id == id); return(new SuccessDataResult <OperationClaim>(result, Messages.OperationClaim.GetByIdSuccess)); }