private async Task validateUserId(string userId) { var userEntity = await ARBRepository.GetUsuarioAsync(userId); if (userEntity == null) { throw new NotFoundItemException($"cannot found user with id:{userId}"); } }
public async Task <Usuario> GetUsuarioAsync(string id) { var userEntity = await ARBRepository.GetUsuarioAsync(id); if (userEntity == null) { throw new NotFoundItemException("User not found"); } var res = mapper.Map <Usuario>(userEntity); res.cantPedidos = res.Pedidos.Count(); res.cantDestinatarios = res.Destinatarios.Count(); return(res); }