public ActionResult Home() { int currentUserId = GetCurrentUserId(); Walker walker = _walkerRepo.GetWalkerById(currentUserId); List <Walk> walks = _walkRepo.GetWalksByWalkerId(currentUserId); Neighborhood neighborhood = _neighborhoodRepo.GetNeighborhoodById(walker.NeighborhoodId); List <Owner> clientOwners = _ownerRepo.GetOwnersByEmployedWalkerId(walker.Id); List <Dog> clientDogs = _dogRepo.GetDogsByEmployedWalkerId(walker.Id); WalkerProfileViewModel vm = new WalkerProfileViewModel() { Walker = walker, Walks = walks, Neighborhood = neighborhood, WalkSummaries = new List <WalkSummaryViewModel>(), clientOwners = clientOwners, clientDogs = clientDogs }; foreach (Walk walk in vm.Walks) { vm.WalkSummaries.Add(new WalkSummaryViewModel() { walk = walk }); } if (vm.Walker == null) { return(NotFound()); } return(View(vm)); }
// GET: Walkers/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkRepo.GetAllWalks(id); int TotalTime = 0; foreach (Walk walk in walks) { TotalTime += walk.Duration; } ; TimeSpan ts = TimeSpan.FromSeconds(TotalTime); WalkerProfileViewModel vm = new WalkerProfileViewModel() { Walker = walker, Walks = walks, TotalTime = TotalTime, TS = ts }; return(View(vm)); }
// GET: Walkers/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); if (walker == null) { return(NotFound()); } List <Walk> walks = _walkRepo.GetWalksByWalkerId(walker.Id); List <Owner> owners = _ownerRepo.GetAllOwners(); List <Dog> ownerDogs = new List <Dog>(); foreach (Owner owner in owners) { List <Dog> dogs = _dogRepo.GetDogsByOwnerId(owner.Id); ownerDogs.ForEach(dog => ownerDogs.Add(dog)); } ; int secs = walks.Sum(walk => walk.Duration); TimeSpan time = TimeSpan.FromSeconds(secs); WalkerProfileViewModel vm = new WalkerProfileViewModel { Walker = walker, Walks = walks, Owners = owners, OwnerDogs = ownerDogs, WalkTime = $"{time.Hours}hr {time.Minutes}min" }; return(View(vm)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walk = _walkRepo.GetWalkByWalkerId(walker.Id); WalkerProfileViewModel vm = new WalkerProfileViewModel() { Walks = walk, Walker = walker }; return(View(vm)); }
// GET: WalksController/Create public ActionResult Create(int id) { Walker walker = _walkerRepository.GetWalkerById(id); int ownerId = GetCurrentOwner(); List <Dog> dogs = _dogRepository.GetDogsByOwnerId(ownerId); AppointmentViewModel avm = new AppointmentViewModel { OwnerId = ownerId, Walker = walker, Doggos = dogs }; return(View(avm)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { int currentUserId = GetCurrentUserId(); if (currentUserId != id) { return(NotFound()); } Walker walker = _walkerRepo.GetWalkerById(id); List <Walks> walks = _walksRepo.GetWalksByWalkerId(walker.Id); int totalWalkSeconds = walks.Sum(w => w.Duration); TimeSpan walkTime = TimeSpan.FromSeconds(totalWalkSeconds); string walkTimeDisplay = $"{walkTime.Hours}Hr {walkTime.Minutes}min"; WalkerProfileViewModel vm = new WalkerProfileViewModel() { Walker = walker, Walks = walks, TotalTimeWalkedDisplay = walkTimeDisplay }; if (walker == null) { return(NotFound()); } return(View(vm)); }
// GET: Walkers/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkRepo.GetWalksById(id); Neighborhood hood = _neighborRepo.GetNeighborhoodById(walker.NeighborhoodId); string walkTotal = _walkRepo.WalkTime(walks); //int walkId = walk.DogId; //Owner owner = _walkRepo.GetOwner(walk.DogId); //Owner owner = _ownerRepo.GetOwnerByDog; ProfileViewModel vm = new ProfileViewModel() { Walker = walker, Walks = walks, Hood = hood, WalkTotal = walkTotal }; if (vm.Walker == null) { return(NotFound()); } return(View(vm)); }
// GET: Walkers/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkRepo.GetWalksByWalkerId(walker.Id); WalkerFormViewModel vm = new WalkerFormViewModel() { Walker = walker, Walks = walks }; if (walker == null) { return(NotFound()); } return(View(vm)); }
// GET: WalksController/Create public ActionResult Create(int id) { BookWalkerViewModel vm = new BookWalkerViewModel() { Walker = _walkerRepo.GetWalkerById(id), CurrentWalks = _walkRepo.GetWalksByWalkerId(id), CurrentOwner = _ownerRepo.GetOwnerById(GetCurrentUserId()), OwnerDogs = _dogRepo.GetDogsByOwnerId(GetCurrentUserId()), Walk = new Walk() { Date = DateTime.Now, WalkerId = _walkerRepo.GetWalkerById(id).Id, WalkStatusId = 1 }, }; return(View(vm)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); if (walker == null) { return(NotFound()); } List <Walks> walks = _walksRepo.GetWalksByWalkerId(id); WalkerProfileModel vm = new WalkerProfileModel() { Walker = walker, Walks = walks }; return(View(vm)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); if (walker == null) { return(NotFound()); } return(View(walker)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); Neighborhood neighborhood = _neighborhoodRepo.GetNeighborhoodById(walker.NeighborhoodId); walker.Neighborhood = neighborhood; List <Walk> walks = _walkRepo.GetWalkerViewWalks(id); if (walker == null) { return(NotFound()); } ProfileViewModel vm = new ProfileViewModel() { Walker = walker, Walks = walks }; return(View(vm)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) //we're passing in an id { Walker walker = _walkerRepo.GetWalkerById(id); //and use that id here if (walker == null) { return(NotFound()); //if it didn't find that id, it's going to call this method that says like it didn't find the id } return(View(walker)); //otherwise we're gonna call walker and say give me a view of it }
// GET: Walkers/Details/5 // Notice that this method accepts an id parameter. //When the ASP.NET framework invokes this method for us, it will take whatever value is in the url and pass it to the Details method. public ActionResult Details(int id) { // Need to implement the Details action in the Walkers controller. Walker walker = _walkerRepo.GetWalkerById(id); if (walker == null) { return(NotFound()); } return(View(walker)); }
// GET: WalkerController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); if (walker == null) { return(NotFound()); } WalkerProfileViewModel vm = createViewModel(id, walker); return(View(vm)); }
// GET: WalksController/Create public ActionResult Create(int walkerId) { int ownerId = GetCurrentUserId(); List <Dog> dogs = _dogRepo.GetDogByOwnerId(ownerId); Walk walk = new Walk() { //add walker from anynomous object passed in Owner/Detail WalkerId = walkerId, Date = DateTime.Today }; Walker walker = _walkerRepo.GetWalkerById(walkerId); WalksFormViewModel vm = new WalksFormViewModel() { Walker = walker, Walk = walk, Dogs = dogs }; return(View(vm)); }
public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walks> walks = _walksRepo.GetAllWalks(); List <Owner> owner = _ownerRepo.GetOwners(); WalkerFormViewModel vm = new WalkerFormViewModel() { Walker = walker, Walks = walks, Owners = owner }; if (walker == null) { return(NotFound()); } else { return(View(vm)); } }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walks> walks = _walkRepo.GetAllWalksById(id); WalkerViewModal vm = new WalkerViewModal { Walker = walker, Walks = walks }; return(View(vm)); }
// GET: WalkersController public ActionResult Index() { int currentUserId = GetCurrentUserId(); Owner owner = _ownerRepo.GetOwnerById(currentUserId); Walker walker = _walkerRepo.GetWalkerById(currentUserId); List <Walker> walkers = new List <Walker>(); if (owner != null) { //only show walkers in user's neighborhood walkers = _walkerRepo.GetWalkersInNeighborhood(owner.NeighborhoodId); } if (walker != null) { walkers = _walkerRepo.GetWalkersInNeighborhood(walker.NeighborhoodId); } if (walker == null && owner == null) { walkers = _walkerRepo.GetAllWalkers(); } return(View(walkers)); }
// GET: Walkers/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkRepo.GetWalksbyWalkerId(walker.Id); WalkerProfileViewModel vm = new WalkerProfileViewModel() { Walker = walker, Walks = walks }; //vm is short for view model return(View(vm)); }
// GET: Walkers/Details/5 //including walks join table methods from WalksRespository //Walker to Profile //List of Walks by that walker Id //Total of minutes walked by that walker passed through timespan method and minutes / hours were added to a string public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walks> walks = _walksRepo.GetWalksByWalkerId(id); string totalWalked = _walksRepo.GetTotalWalkedByWalkerId(id); WalkerProfileViewModel vm = new WalkerProfileViewModel() { GetWalksByWalkerId = walks, Walker = walker, GetTotalWalkedByWalkerId = totalWalked }; return(View(vm)); }
// GET: Walks/Create public ActionResult Create(int walkerId) { Walker walker = _walkerRepo.GetWalkerById(walkerId); RequestWalkViewModel viewModel = new RequestWalkViewModel() { Walk = new Walk() { Date = DateTime.Now, WalkerId = walker.Id, WalkStatusId = 1 }, Walker = walker, Dogs = _dogRepo.GetDogsByOwnerId(GetCurrentUserId()) }; return(View(viewModel)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkRepository.GetAllWalks(); if (walker == null) { return(NotFound()); } WalkerFormViewModel vm = new WalkerFormViewModel() { walker = walker, Walks = walks }; return(View(vm)); }
//// GET: Owners/Details/5 //public ActionResult Details(int id) //{ // Owner owner = _ownerRepo.GetOwnerById(id); // if (owner == null) // { // return NotFound(); // } // return View(owner); //} //Chp 5 model view method // GET: Owners/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkRepo.GetALLWalksandIds(walker.Id); //We used the items declared above.....to pair our new lists/paramenters with the requested Id //and then shoved it into a profileVIEW, then we returned it. (Had to change details panel) WalkerDetailsViewModel vm = new WalkerDetailsViewModel() { Walker = walker, // Dogs = dogs, Walks = walks }; return(View(vm)); }
// GET: Walkers/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); Neighborhood neighborhood = _neighborhoodRepo.GetNeighborhoodByWalkerId(walker.Id); List <Walk> walks = _walkRepo.GetWalksByWalkerId(walker.Id); List <Dog> dogs = _dogRepo.GetDogsByOwnerId(walker.Id); WalkerProfileViewModel vm = new WalkerProfileViewModel() { Walker = walker, Neighborhood = neighborhood, Walks = walks, Dogs = dogs }; return(View(vm)); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkRepo.GetWalksByWalkerId(walker.Id); DetailViewModel vm = new DetailViewModel() { Walker = walker, Walks = walks }; return(View(vm)); //if (walker == null) //{ // return NotFound(); //} //return View(walker); }
// GET: WalkersController/Details/5 public ActionResult Details(int id) { int walkerId = GetCurrentWalker(); Walker walker = _walkerRepo.GetWalkerById(walkerId); List <Walks> walks = _walksRepo.GetWalksByWalker(walkerId); WalkerProfileViewModel vm = new WalkerProfileViewModel { Walker = walker, Walks = walks }; if (walker == null) { return(NotFound()); } return(View(vm)); }
// GET: Walkers/Details/ public ActionResult Details(int id) { Walker walker = _walkerRepo.GetWalkerById(id); List <Walk> walks = _walkerRepo.GetWalksByWalkerId(id); // Initiate variable to hold total seconds the walker walked int secondsWalked = 0; foreach (Walk walk in walks) { secondsWalked += walk.Duration; } walker.TotalWalkTime = DateTime.Today.Add(TimeSpan.FromSeconds(secondsWalked)).ToString("hh:mm"); WalkerProfileViewModel vm = new WalkerProfileViewModel() { Walker = walker, Walks = walks }; return(View(vm)); }