public async Task <bool> AddOfferAsync(OfferModel offerModel) { var objectJson = JsonConvert.SerializeObject(offerModel); var result = await _database.StringSetAsync(OfferKeyCache.OfferKey(offerModel.Id.ToString()), objectJson); return(result); }
public async Task <OfferModel> GetOfferAsync(string offerId) { OfferModel result = null; var key = OfferKeyCache.OfferKey(offerId); if (_database.KeyExists(key)) { var data = await _database.StringGetAsync(key); result = JsonConvert.DeserializeObject <OfferModel>(data); } return(result); }