Ejemplo n.º 1
0
        public async Task <IActionResult> Details(int?id)
        {
            if (!id.HasValue || id == null)
            {
                return(NotFound());
            }

            PlaceDetailsViewModel place;

            if (User.IsInRole("Admin"))
            {
                place = await _placesService.GetPlaceByIdForAdmin(id.Value);
            }
            else
            {
                place = await _placesService.GetPlaceById(id.Value);
            }

            if (place == null)
            {
                return(NotFound());
            }

            return(View(place));
        }