Пример #1
0
        //
        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));
        }
Пример #2
0
 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));
     }
 }
Пример #3
0
        // 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));
        }