public bool UpdateResourceString([FromBody] dynamic parm)
        {
            string value = parm.value;
            string resourceId = parm.resourceId;
            string resourceSet = parm.resourceSet;
            string localeId = parm.localeId;
            string comment = parm.comment;

            var item = Manager.GetResourceItem(resourceId, resourceSet, localeId);
            if (item == null)
            {
                item = new ResourceItem()
                {
                    ResourceId = resourceId,
                    LocaleId = localeId,
                    ResourceSet = resourceSet,
                    Comment = comment
                };
            }

            if (string.IsNullOrEmpty(value))
                return Manager.DeleteResource(resourceId, resourceSet: resourceSet, cultureName: localeId);

            item.Value = value;
            item.Type = null;
            item.FileName = null;
            item.BinFile = null;
            item.TextFile = null;

            if (Manager.UpdateOrAddResource(item) < 0)
                return false;

            return true;
        }
Ejemplo n.º 2
0
        public bool UpdateResourceString(string Value, string ResourceId, string ResourceSet, string LocaleId)
        {
            if (string.IsNullOrEmpty(Value))
            {
                return(Manager.DeleteResource(ResourceId, LocaleId, ResourceSet));
            }

            if (Manager.UpdateOrAdd(ResourceId, Value, LocaleId, ResourceSet, null) == -1)
            {
                return(false);
            }

            return(true);
        }
        public bool UpdateResourceString(dynamic parm)
        {
            string value       = parm.value;
            string resourceId  = parm.resourceId;
            string resourceSet = parm.resourceSet;
            string localeId    = parm.localeId;

            var item = Manager.GetResourceItem(resourceId, resourceSet, localeId);

            if (item == null)
            {
                item = new ResourceItem()
                {
                    ResourceId  = resourceId,
                    LocaleId    = localeId,
                    ResourceSet = resourceSet
                };
            }

            if (string.IsNullOrEmpty(value))
            {
                return(Manager.DeleteResource(resourceId, resourceSet: resourceSet, cultureName: localeId));
            }

            item.Value    = value;
            item.Type     = null;
            item.FileName = null;
            item.BinFile  = null;
            item.TextFile = null;

            if (Manager.UpdateOrAddResource(item) < 0)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Deletes a resource entry
        /// </summary>
        /// <param name="resourceId">The resource to delete</param>
        /// <param name="lang">The language Id - Be careful:  If empty or null deletes matching keys for all languages</param>
        /// <param name="resourceSet">The resource set to apply</param>
        /// <returns>true or false</returns>
        public static bool DeleteResource(string resourceId, string resourceSet = null, string lang = null)
        {
            var db = new DbResourceDataManager();

            return(db.DeleteResource(resourceId, lang, resourceSet));
        }