Beispiel #1
0
 private static AppResourceEntity GetResourceById(int resourceId)
 {
     #region sanity checks
     if (resourceId < 0)
     {
         throw new ArgumentException("Invalid parameter", "resourceId");
     }
     #endregion
     string            key      = string.Format(_cacheKeyFormat, resourceId);
     AppResourceEntity resource = _cache.GetOrAdd(
         key,
         resourceId,
         (k, r) =>
     {
         return(AppResourceDataLayer.GetResourceById(r));
     },
         _policy
         );
     return(resource);
 }
        public AppResourceEntity Edit(IAppResourceModel model)
        {
            AppResourceEntity entity = null;

            if (model.Id > 0)
            {
                entity = Resources.Find(model.Id);
                DbContext.Entry(entity).State = EntityState.Modified;
            }
            else
            {
                entity = new AppResourceEntity();
                Resources.Add(entity);
            }

            //entity.Key = model.Key;
            entity.Value     = model.Value;
            entity.SectionId = model.SectionId;

            Save();

            return(entity);
        }
 /// <summary>
 /// DO NOT USE
 /// </summary>
 /// <param name="editedInstance"></param>
 /// <returns></returns>
 public AppResourceEntity Edit(AppResourceEntity editedInstance)
 {
     throw new NotImplementedException();
 }