Пример #1
0
        private void AddLinkCommandHandler()
        {
            var link = new Link {
                Name = Name, Uri = new Uri(Url)
            };

            LinkService.Add(link);

            Frame.Navigate(typeof(AppHub), link);
        }
Пример #2
0
        public async void Addlink(string url)
        {
            URL         = url;
            Description = url;
            if (url.Length > 20)
            {
                Description = url.Substring(0, 20);
            }
            RatingStars = 3;

            AddLink addLink = new AddLink();

            addLink.DataContext = this;
            var res = await addLink.ShowAsync();

            if (res == ContentDialogResult.Primary)
            {
                using (var logic = new LinkService())
                {
                    var link = new Link()
                    {
                        DateTime    = DateTime.Now,
                        URL         = url,
                        Description = Description,
                        RatingStars = 0,
                        GroupId     = groupId,
                        //  Image = await ConvertImageSql.ConvertToBytesAsync(image),
                        Tags = new List <Tag>(),
                    };

                    logic.Add(link);
                    logic.Save();

                    Links.Add(link);
                }
            }

            //var dialog = new MessageDialog("Czy jesteś pewien usunięcia grupy '" + objectToDelete.Name + "' ?");
            //dialog.Title = "Naprawdę?";
            //dialog.Commands.Add(new UICommand { Label = "Tak", Id = 0 });
            //dialog.Commands.Add(new UICommand { Label = "Nie", Id = 1 });
            //var res = await dialog.ShowAsync();

            //if ((int)res.Id == 0)
            //{
            //    using (var logic = new GroupService())
            //    {
            //        logic.DeleteCurrentGroup(objectToDelete);
            //    }
            //    Groups.Remove(objectToDelete);
            //}
        }
Пример #3
0
 public ActionResult <string> AddLink([FromBody] Link link)
 {
     _linkService.Add(link);
     return(Ok(link));
 }