public ActionResult Create() { KategoriaZRodzicem temp = new KategoriaZRodzicem(); var list = _repo.PobierzKategorie().ToList(); temp.ojciec = list.Select(m => new SelectListItem { Value = m.Id.ToString(), Text = m.Nazwa }); temp.głownyOjciec = list.Select(m => new SelectListItem { Value = m.Id.ToString(), Text = m.Nazwa }); return View(temp); }
public ActionResult Create(KategoriaZRodzicem model) { if (ModelState.IsValid) { _repo.DodajKategorie(model); TempData["Message"] = "Dodano kategorię ! Gratulacje !"; return RedirectToAction("Index"); } else return View(model); }