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")); }
public IActionResult UpdateRollerSkateMapLocation([FromBody] RollerSkateMapLocation updatedRollerSkateMapLocation) { _rollerSkateMapLocationRepository.UpdateRollerSkateMapLocation(updatedRollerSkateMapLocation); return(Ok()); }