// public ActionResult Book(int id) { BookWalkerViewModel vm = new BookWalkerViewModel { Walker = _walkerRepo.GetWalkerById(id), CurrentWalks = _walkRepo.GetWalksByWalkerId(id), CurrentOwner = _ownerRepo.GetOwnerById(GetCurrentUserId()), OwnerDogs = _dogRepo.GetDogsByOwnerId(GetCurrentUserId()) }; return(View(vm)); }
public ActionResult Create(BookWalkerViewModel vm) { try { _walkRepo.RequestWalk(vm.Walk); return(RedirectToAction(nameof(Index), "Owners")); } catch { BookWalkerViewModel reloadVM = vm; reloadVM.OwnerDogs = _dogRepo.GetDogsByOwnerId(GetCurrentUserId()); return(View(reloadVM)); } }
// 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)); }