Esempio n. 1
0
        // GET: Location/Edit/5
        public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var userId   = _userManager.GetUserId(User);
            var location = _locationService.GetById(id);

            if (location == null || location.ApplicationUser.Id != userId)
            {
                return(NotFound());
            }

            var model = new LocationListingModel
            {
                Id              = location.Id,
                LocationName    = location.LocationName,
                MyDotEmail      = location.MyDotEmail,
                C4AccountName   = location.C4AccountName,
                ApplicationUser = userId
            };

            if (location == null)
            {
                return(NotFound());
            }
            return(View(model));
        }
Esempio n. 2
0
        public IActionResult EditLocation(long Id)
        {
            var location = locationRepository.GetById(Id);

            if (location == null)
            {
                ViewBag.ErrorMessage = $"location resource with { Id } not found";
                return(View("Error"));
            }
            EditLocationViewModel model = new EditLocationViewModel
            {
                Id         = location.Id,
                Title      = location.Title,
                Number     = location.Number,
                CategoryId = location.LocationCategoryId
            };

            GetAllCategories(model);
            return(PartialView(model));
        }
        public IActionResult EventDetails(long Id)
        {
            Event events = eventRepository.GetEventById(Id);

            if (events == null)
            {
                ViewBag.ErrorMessage = $"The event with reference Id = { Id } could not be found";
                return(View("error"));
            }
            EventDetailsViewModel model = new EventDetailsViewModel
            {
                GetEvent      = events,
                EventLocation = locationRepository.GetById(events.LocationId),
                EventCat      = eventRepository.GetEventCategoryById(events.EventCategoryId)
            };

            return(View(model));
        }