Exemplo n.º 1
0
        public async Task OnGetAsync(int?id)
        {
            if (!id.HasValue)
            {
                return;
            }

            var tags = await ptc.GetAllTagsAsync();

            foreach (var t in tags)
            {
                if (t.TagId == id.Value)
                {
                    ViewData["Tag"] = t.TagId.ToString() + " : " + t.Type + ", " + t.Name;

                    List <ServiceReferencePhotoTag.Tag> l = new List <ServiceReferencePhotoTag.Tag>();
                    l.Add(t);
                    var photos = await ptc.GetPhotosWithTagsAsync(l);

                    foreach (var p in photos)
                    {
                        Models.PhotoDTO pdto = new Models.PhotoDTO();
                        pdto.PhotoId   = p.PhotoId;
                        pdto.Path      = p.Path;
                        pdto.CreatedAt = p.CreatedAt;
                        Photos.Add(pdto);
                    }
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public async Task OnGetAsync()
        {
            var photos = await ptc.GetAllPhotosAsync();

            foreach (var item in photos)
            {
                Models.PhotoDTO pdto = new Models.PhotoDTO();
                pdto.CreatedAt = item.CreatedAt;
                pdto.Deleted   = item.Deleted;
                pdto.Path      = item.Path;
                pdto.PhotoId   = item.PhotoId;
                foreach (var t in item.Tags)
                {
                    Models.TagDTO tdto = new Models.TagDTO();
                    tdto.Name  = t.Name;
                    tdto.TagId = t.TagId;
                    tdto.Type  = t.Type;
                    pdto.Tags.Add(tdto);
                }
                Photos.Add(pdto);
            }
        }