public async Task OnGetAsync(int?id) { if (!id.HasValue) { return; } var photos = await ptc.GetAllPhotosAsync(); foreach (var p in photos) { if (p.PhotoId == id.Value) { ViewData["Photo"] = p.PhotoId.ToString() + " : " + p.Path; var tags = await ptc.GetTagsOfPhotoAsync(p); foreach (var tag in tags) { Models.TagDTO tdto = new Models.TagDTO(); tdto.TagId = tag.TagId; tdto.Name = tag.Name; tdto.Type = tag.Type; Tags.Add(tdto); } Tags.Sort(new Comparer()); break; } } }
public async Task OnGetAsync() { var tags = await ptc.GetAllTagsAsync(); foreach (var t in tags) { Models.TagDTO tdto = new Models.TagDTO(); tdto.TagId = t.TagId; tdto.Type = t.Type; tdto.Name = t.Name; Tags.Add(tdto); } Tags.Sort(new Comparer()); }
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); } }