Example #1
0
        public async Task OnGet()
        {
            var token    = HttpContext.Request.Cookies["TraverlApp.fun.Token"];
            var fullTrip = ((await _trips.ReadWithData(Id, token)) as ObjectResult).Value as FullTrip;

            Trip           = fullTrip;
            Trip.Goals     = fullTrip.Goals;
            Trip.Places    = fullTrip.Places;
            Trip.Goods     = fullTrip.Goods;
            Trip.Purchases = fullTrip.Purchases;
            Trip.Photos    = await GetElements <PhotoController, Photo>(_photos, Trip.PhotoIds, token, "Get");

            Trip.Files = await GetElements <FileController, TravelAppModels.Models.File>(_files, Trip.FileIds, token, "Get", Trip.Id);

            if (Trip.Notes == null)
            {
                Trip.Notes = new Note[0];
            }

            foreach (var place in Trip.Places)
            {
                place.Photos = await GetElements <PhotoController, Photo>(_photos, place.PhotoIds, token, "Get");
            }

            Categories = ((await _categories.GetAll()) as ObjectResult).Value as Category[];
        }