/// <summary> /// Metoda dodajaca nowy kontener do obserwowalnej kolekcji kontenerow /// </summary> private async Task AddContainer() { try { HttpWorkItemCollectionClient client = new HttpWorkItemCollectionClient(); WorkItemCollectionPublic workItemCollection = new WorkItemCollectionPublic() { Name = "Unnamed Collection", TaskBoardID = mTaskBoard.ID }; WorkItemCollectionPublic response = await client.CreateWorkItemCollection(workItemCollection).ConfigureAwait(false); response.WorkItems = new List <WorkItemPublic>(); await Application.Current.Dispatcher.BeginInvoke(() => { ContainerCollection.Add(new CtrlWorkItemContainer(mContext, response)); }); } catch (Exception ex) { mContext.DialogBuilder.ErrorDialog("Could not create a collection, due to server error.", ex); } }
/// <inheritdoc/> public WorkItemCollectionPublic CreateWorkItemCollection(WorkItemCollectionPublic workItemCollection) { Ensure.ParamNotNull(workItemCollection, nameof(workItemCollection)); mWorkItemCollections.Add(workItemCollection); return(workItemCollection); }
public virtual IActionResult CreateWorkItemCollection([FromBody] WorkItemCollectionPublic collection) { Ensure.ParamNotNull(collection, nameof(collection)); WorkItemCollectionPublic createdWorkItemCollection = mRepository.CreateWorkItemCollection(collection); return(base.Created($"/WorkItemCollections/{createdWorkItemCollection.ID}", createdWorkItemCollection)); }
public WorkItemCollectionPublic UpdateWorkItemCollection(WorkItemCollectionPublic workItemCollection) { Ensure.ParamNotNull(workItemCollection, nameof(workItemCollection)); WorkItemCollectionLogic wicLogic = new WorkItemCollectionLogic(mDBContext); WorkItemCollectionConverter converter = new WorkItemCollectionConverter(mDBContext); WorkItemCollection updatedCollection = wicLogic.UpdateWorkItemCollection(converter.Convert(workItemCollection)); mDBContext.SaveChanges(); return(converter.Convert(updatedCollection)); }
/// <summary> /// Konstruktor /// </summary> public WorkItemContainerViewModel(ITerminalContext context, WorkItemCollectionPublic wic) { Ensure.ParamNotNull(wic, nameof(wic)); mContext = context; WorkItemCollection = wic; Name = wic.Name; AddWorkItemCommand = new AsyncCommand(AddWorkItem); ShowEditDialogCommand = new BasicCommand <WorkItemPublic>(ShowEditDialog); WorkItems = new ObservableCollection <WorkItemPublic>(wic.WorkItems); }
public virtual IActionResult UpdateCollection([FromBody] WorkItemCollectionPublic workItemCollection) { Ensure.ParamNotNull(workItemCollection, nameof(workItemCollection)); WorkItemCollectionPublic updatedCollection = mRepository.UpdateWorkItemCollection(workItemCollection); if (updatedCollection == null) { return(base.NotFound()); } return(base.Created($"/workItemCollections/{updatedCollection.ID}", updatedCollection)); }
/// <summary> /// Wysyła wiadomość o aktualizacji kolekcji /// </summary> public void UpdateCollection(WorkItemCollectionPublic collection) { if (CollectionUpdatedEvent == null) { return; } Ensure.ParamNotNull(collection, nameof(collection)); WorkItemCollectionEventArgs wice = new WorkItemCollectionEventArgs() { Collection = collection }; CollectionUpdatedEvent(this, wice); }
/// <summary> /// pobiera workItemy dla kolekcji /// </summary> private async Task GetWorkItems(WorkItemCollectionPublic collection) { try { HttpWorkItemClient client = new HttpWorkItemClient(); IEnumerable <WorkItemPublic> response = await client.GetAllWorkItems(collection.ID).ConfigureAwait(false); await Application.Current.Dispatcher.BeginInvoke(() => { foreach (WorkItemPublic workItem in response) { collection.WorkItems.Add(workItem); } }); } catch (Exception ex) { mContext.DialogBuilder.ErrorDialog("Could not retrieve work items, due to server error.", ex); } }
/// <inheritdoc/> public async Task <WorkItemCollectionPublic> UpdateWorkItemCollection(WorkItemCollectionPublic workItem) { Ensure.ParamNotNull(workItem, nameof(workItem)); WorkItemCollectionPublic UserResponse = null; using (HttpClient httpClient = base.CreateClient()) { string jsonString = JsonConvert.SerializeObject(workItem); Uri postUri = new Uri(httpClient.BaseAddress, "/WorkItemCollections/"); HttpResponseMessage response = await httpClient.PutAsync(postUri, new StringContent(jsonString, Encoding.UTF8, "application/json")); if (response.IsSuccessStatusCode) { string json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); UserResponse = JsonConvert.DeserializeObject <WorkItemCollectionPublic>(json); } } return(UserResponse); }
public CtrlWorkItemContainer(ITerminalContext context, WorkItemCollectionPublic wic) { InitializeComponent(); this.DataContext = new WorkItemContainerViewModel(context, wic); }
/// <inheritdoc/> public WorkItemCollectionPublic UpdateWorkItemCollection(WorkItemCollectionPublic workItemCollection) { return(workItemCollection); }