Ejemplo n.º 1
0
        public async Task <RetailerModel> GetRetailerById(int id)
        {
            var entity = await _retailerRepository.GetById(id);

            var model = entity?.MapTo <RetailerModel>();

            return(model);
        }
Ejemplo n.º 2
0
 public Retailer GetById(string id)
 {
     try
     {
         _domain.DoCommand(CommandType.GetById, null);
         return(_repository.GetById(ObjectId.Parse(id)));
     }
     catch (Exception ex)
     {
         _domain.DoCommand(CommandType.Exception, ex);
         return(null);
     }
 }
Ejemplo n.º 3
0
        public RetailerQuery(IRetailerRepository retailerRepo)
        {
            Name = "RetailerQuery";

            Field <RetailerType>(
                "retailer",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "retailerId"
            }),
                resolve: context => retailerRepo.GetById(context.GetArgument <int>("retailerId")));

            Field <ListGraphType <RetailerType> >(
                "retailers",
                resolve: context => retailerRepo.GetAll());
        }
 public Retailer GetById(int retailerId)
 {
     return(cacheBroker.TryGet <Retailer>(string.Format(CacheKeys.RetailerCacheKey, retailerId), () => retailerRepository.GetById(retailerId), Volatility.Low));
 }