public async Task <string> ModifyTemplateForDesignerAsync([FromBody] DesignerData data) { var template = $"{Global.Hospital}@{data.Component}@{data.DataType}"; var instance = new RenderDetail { Height = data.Height, Width = data.Width, Rendering = data.Rendering, }; if (mongo.DesignerTemplateCollection.AsQueryable().Any(t => t.UniqueId == template)) { await mongo.DesignerTemplateCollection.UpdateOneAsync(t => t.UniqueId == template, Builders <DesignerTemplate> .Update.Push(t => t.RenderDetails, instance).Set(t => t.DisplayName, data.DisplayName)); } else { var t = new DesignerTemplate { UniqueId = template, DisplayName = data.DisplayName, RenderDetails = new List <RenderDetail> { instance, } }; await mongo.DesignerTemplateCollection.InsertOneAsync(t); } return(template); }
public NoteViewModel(ITrackerRepository track, ILoggingService logger, IImageCaptureService capture) { Cards = new ObservableCollection <Card>(); Decks = new ObservableCollection <MatchResult>(); HasScreenshots = false; if (IsInDesignMode) { _repository = new DesignerRepository(); Screenshots = DesignerData.GenerateScreenshots(); HasScreenshots = true; } else { _repository = track; } _cap = capture; _log = logger; PropertyChanged += NoteViewModel_PropertyChanged; WindowClosingCommand = new RelayCommand(() => Closing()); Update(); }
/// <summary> /// Complete initializing after the context is set /// </summary> internal void Initialize() { if (this.Context.IsUpdating) { this.ServiceName = this.Context.UpdateContext.ServiceFolder.Text; DesignerData designerData = this.Context.GetExtendedDesignerData <DesignerData>(); if (designerData != null) { this.ExtraInformation = designerData.ExtraInformation; } } }