public async Task <ActionResult <EntityResponse <MoneyApproval> > > GetAllMoneyApprovalEntity() { var query = new GetListMoneyApprovalQuery(); var result = await _mediator.Send(query); return(Ok(result)); }
public async Task <EntityResponse <MoneyApproval> > Handle(GetListMoneyApprovalQuery request, CancellationToken cancellationToken) { var response = new EntityResponse <MoneyApproval> () { ReponseName = nameof(GetListMoneyApprovalQuery), Content = new List <MoneyApproval> () { } }; var entities = await _approvalRepository.GetAllAsync(); _mapper.Map <List <MoneyApproval> > (entities); if (entities == null) { response.Status = ResponseType.Warning; response.Message = $"No {nameof(MoneyApproval)}s were found."; response.Content = null; } else { response.Status = ResponseType.Success; response.Message = $"{nameof(MoneyApproval)}s get successfully."; response.Content.AddRange(entities); } return(response); }