public IActionResult Locations(int page = 1)
        {
            ViewBag.Current = "Locations";

            LocationsViewModel locationsViewModel = new LocationsViewModel
            {
                RollerSkateMapLocations       = _locationRepository.GetAllRollerSkateMapLocations().OrderBy(d => d.LocationCreatedDateTime).ToList(),
                RollerSkateMapLocationPerPage = 3,
                CurrentPage  = page,
                GoogleApiKey = _appConfiguration.GoogleMapApiKey
            };

            return(View(locationsViewModel));
        }
        public IActionResult DeleteUser(int id)
        {
            List <Comment> comments = _commentRepository.GetAllComments().Where(x => x.UserId == id).ToList();
            List <RollerSkateMapLocation> locations = _locationRepository.GetAllRollerSkateMapLocations().Where(x => x.UserId == id).ToList();

            foreach (var comment in comments)
            {
                comment.UserId = null;
                _commentRepository.UpdateComment(comment);
            }

            foreach (var location in locations)
            {
                location.UserId = null;
                _locationRepository.UpdateRollerSkateMapLocation(location);
            }

            _userRepository.DeleteUser(id);

            return(Json("Ok"));
        }
예제 #3
0
 public IActionResult GetAllRollerSkateMapLocations()
 {
     return(Ok(_rollerSkateMapLocationRepository.GetAllRollerSkateMapLocations()));
 }