Beispiel #1
0
        /*
         * make for razor
         */

        public async Task <GetplaceWithIdOutputDto> GetByid(int id)
        {
            var place = TuristPlaceRepository.GetQuery().Include(p => p.Rates)
                        .ThenInclude(c => c.User)
                        .FirstOrDefault(p => p.Id == id);
            var endplace = new GetplaceWithIdOutputDto();

            endplace.Id           = id;
            endplace.Image        = place.Image;
            endplace.Name         = place.Name;
            endplace.Visit        = place.Visit;
            endplace.Description  = place.Description;
            endplace.AverageRates = place.Rates.Average(x => x.UserRate);

            return(endplace);
        }
        public async Task OnGet(int id)
        {
            getitem = await turistPlaceService.GetByid(id);

            await turistPlaceService.DeleteById(id);
        }