Example #1
0
        public virtual ActionResult Create(DogFeedingEntry model)
        {
            var dog = _dogProfileRepo.GetById(model.DogProfileID);

            if (dog == null)
                return HttpNotFound();

            if (!ModelState.IsValid)
            {
                SetDogViewBag(dog);
                return View(model);
            }

            _dogFeedingRepo.Insert(model);

            return RedirectToAction("Index", new { dog = model.DogProfileID });
        }
        public ActionResult Edit(DogFeedingEntry model)
        {
            if (model == null)
                return HttpNotFound();

            var dog = _dogProfileRepo.GetById(model.DogProfileID);

            if (dog == null)
                return HttpNotFound();

            if (!ModelState.IsValid)
            {
                SetDogViewBag(dog);
                return View(model);
            }

            _dogFeedingRepo.Update(model);

            return RedirectToAction("Index", new { dog = dog.ProfileID });
        }