示例#1
0
        public void Update(UpdateDetails updateDetails)
        {
            var entityToUpdate = _dbContext.Find <Entities.Master.UpdateDetails>(updateDetails.Id);

            if (entityToUpdate != null)
            {
                _mapper.Map(updateDetails, entityToUpdate);
                _dbContext.Update(_mapper.Map <Entities.Master.UpdateDetails>(entityToUpdate),
                                  post => post.MapTo(updateDetails), _mapper);
            }
        }
示例#2
0
        public void Add(TaskInstance taskInstance)
        {
            var taskInstanceId = (taskInstance ?? throw new ArgumentNullException(nameof(taskInstance))).Id;
            var entity         = _dbContext.Query <Entities.Master.TaskInstance>()
                                 .Include(e => e.Parameters).FirstOrDefault(x => x.Id == taskInstanceId);

            if (entity == null)
            {
                _dbContext.Add(_mapper.Map <Entities.Master.TaskInstance>(taskInstance),
                               post =>
                {
                    post.MapTo(taskInstance);
                }, _mapper);
            }
            else
            {
                _mapper.Map(taskInstance, entity);
                _dbContext.Update(_mapper.Map <Entities.Master.TaskInstance>(entity),
                                  post => post.MapTo(taskInstance), _mapper);
            }
        }
示例#3
0
        public void Update(Tenant tenant)
        {
            var entity = _dbContext.Find <Entities.Master.Tenant>(
                (tenant ?? throw new ArgumentNullException(nameof(tenant))).Id);

            if (entity != null)
            {
                _mapper.Map(tenant, entity);
                _dbContext.Update(_mapper.Map <Entities.Master.Tenant>(entity),
                                  post => post.MapTo(tenant), _mapper);
            }
        }
        public void SetPreviewFile(int entityId, PreviewFile previewFile, Stream previewFileStream)
        {
            var entity = GetEntityById(entityId);

            if (entity != null)
            {
                entity.Preview = null;
                entity.Preview = _mapper.Map <Entities.Master.PreviewFile>(previewFile);
                entity.Preview.SetContentBytes(previewFileStream.ToByteArray());
                _dbContext.Update(entity, post =>
                {
                    //post.MapTo( entity.Preview );
                }, _mapper);
            }
        }
示例#5
0
        public void SetUserSetting(int userId, string key, string value)
        {
            var setting = _dbContext.Query <UserSetting>().FirstOrDefault(e => e.UserId == userId && e.Name == key);

            if (setting != null)
            {
                setting.Value = value;
                _dbContext.Update(setting, post => post.MapTo(setting), _mapper);
            }
            else
            {
                _dbContext.Add(new UserSetting()
                {
                    Name = key, UserId = userId, Value = value
                });
            }
        }
示例#6
0
 public void Update(ProductSettings productSettings) =>
 _dbContext.Update(_mapper.Map <Entities.Master.ProductSettings>(productSettings),
                   post => post.MapTo(productSettings), _mapper);