예제 #1
0
        protected override void UpdateAttribute(IUpdateBuilder <TranscriberTaskEntity> update, string name, object value)
        {
            switch (name)
            {
            case nameof(TranscriberTaskResource.Book):
                if (value == null)
                {
                    update.Unset(u => u.Book);
                }
                else
                {
                    update.Set(u => u.Book, (string)value);
                }
                break;

            case nameof(TranscriberTaskResource.Description):
                if (value == null)
                {
                    update.Unset(u => u.Description);
                }
                else
                {
                    update.Set(u => u.Description, (string)value);
                }
                break;

            default:
                base.UpdateAttribute(update, name, value);
                break;
            }
        }
예제 #2
0
        protected override void UpdateAttribute(IUpdateBuilder <UserEntity> update, string name, object value)
        {
            switch (name)
            {
            case nameof(UserResource.ParatextId):
                if (value == null)
                {
                    update.Unset(u => u.ParatextId);
                    update.Unset(u => u.ParatextTokens);
                }
                break;

            case nameof(UserResource.Site):
                SiteOptions siteOptions = _siteOptions.Value;
                string      siteKey     = siteOptions.Id;
                if (value == null)
                {
                    update.Unset(u => u.Sites[siteKey]);
                }
                else if (((Site)value).CurrentProjectId == null)
                {
                    update.Unset(u => u.Sites[siteKey].CurrentProjectId);
                }
                else
                {
                    update.Set(u => u.Sites[siteKey].CurrentProjectId, ((Site)value).CurrentProjectId);
                }
                break;

            default:
                base.UpdateAttribute(update, name, value);
                break;
            }
        }
예제 #3
0
        public bool Update(IUpdateBuilder <TThisEntity> update, IEnumerable <string> ids)
        {
            if (!_updateAllowed)
            {
                return(false);
            }
            string id = ids.Single();

            if (id == null)
            {
                update.Unset(_getFieldExpr);
            }
            else
            {
                update.Set(_getFieldExpr, id);
            }
            return(true);
        }