コード例 #1
0
        public ActionResult NoviTermin(TerminViewModel model)
        {
            ViewBag.Title = "Novi termin";

            if (ModelState.IsValid)
            {
                var isDodan = _helperRepository.DodajTermin(model);
                if (isDodan)
                {
                    return(PartialView("_uspjeh", "/Admin/Termini"));
                }
                else
                {
                    return(PartialView("_greska", "/Admin/Termini"));
                }
            }
            else
            {
                model.Bazeni  = _helperRepository.GetBazeni();
                model.Treneri = _accountRepository.GetTreneri();
                model.Grupe   = _helperRepository.GetGrupe();

                ModelState.AddModelError("", "Provjerite podatke i pokušajte opet.");
                return(PartialView("_noviTermin", model));
            }
        }