Ejemplo n.º 1
0
        public async Task<int> RemoveTagFromLink(Link SelectedLink, Tag SelectedUsedTag) {
            try {
                _dataService.Links.Attach(SelectedLink);
                _dataService.Tags.Attach(SelectedUsedTag);

                SelectedLink.Tags.Remove(SelectedUsedTag);
                return await _dataService.SaveChangesAsync();
            } catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        private void OnAddSelectedTagCommand()
        {
            using (var repo = Autofac.Resolve<ILinkRepositoryAsync>()) {
                if (!String.IsNullOrEmpty(AdditionalTagsString)) { // add new tags from textbox
                    var newTags = AdditionalTagsString.Split(',');
                    for (var i = 0; i < newTags.Length; i++)
                        newTags[i] = newTags[i].Trim();

                    repo.AddNewTagsToLink(SelectedLink, newTags);

                    foreach (var tag in SelectedLink.Tags) {
                        if (!_tagList.Contains(tag))
                            _tagList.Add(tag);
                    }

                    AdditionalTagsString = String.Empty;
                    SelectedAvailableTag = SelectedUsedTag = null;
                } else if (SelectedAvailableTag != null) { // add tag from listbox
                    try {
                        repo.AddTagToLink(SelectedLink, SelectedAvailableTag);
                        AvailableTags.Remove(SelectedAvailableTag);
                    } catch (Exception ex) {
                        throw ex;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public async Task<int> AddTagToLink(Link selectedLink, Tag selectedAvailableTag) {
            try {
                _dataService.Links.Attach(selectedLink);
                _dataService.Tags.Attach(selectedAvailableTag);

                selectedLink.Tags.Add(selectedAvailableTag);
                return await _dataService.SaveChangesAsync();
            } catch (Exception ex) {
                throw ex;
            }
        }