Exemple #1
0
        public ActionResult Create(RequestWalkViewModel viewModel)
        {
            try
            {
                _walkRepo.AddWalk(viewModel.Walk);

                return(RedirectToAction(nameof(Index), "Owners"));
            }
            catch
            {
                RequestWalkViewModel sameView = viewModel;
                viewModel.Dogs = _dogRepo.GetDogsByOwnerId(GetCurrentUserId());

                return(View(sameView));
            }
        }
Exemple #2
0
        // 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));
        }