Пример #1
0
        public ActionResult Add(string name, string text)
        {
            Data.Lookup persistentLookup = new Data.Lookup {
                LookupName = name, Value = text
            };
            LookingUp.Add(persistentLookup);
            Caching.AddLookupValue(persistentLookup);

            return(Content(JsonConvert.SerializeObject(new Models.Lookup(persistentLookup.ID, persistentLookup.Value))));
        }
Пример #2
0
 public DefaultController(ILogger <DefaultController> logger,
                          IDistributedCache cache,
                          IConfiguration config,
                          Data.Lookup lookup,
                          Data.Update update)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _cache  = cache ?? throw new ArgumentNullException(nameof(cache));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _lookup = lookup ?? throw new ArgumentNullException(nameof(lookup));
     _update = update ?? throw new ArgumentNullException(nameof(update));
 }
Пример #3
0
        public ActionResult Update(string name, Models.Lookup entry)
        {
            Data.Lookup persistentLookup = new Data.Lookup
            {
                LookupName = name,
                ID         = entry.Value,
                Value      = entry.Text
            };
            LookingUp.Update(persistentLookup);

            Caching.UpdateLookupValue(persistentLookup);

            return(Content(JsonConvert.SerializeObject(new Models.Lookup(persistentLookup.ID, persistentLookup.Value))));
        }