public ActionResult WypelnijAtrybuty(string category, string tytul, string nazwa) { List<AtrybutZWartosciami> model = new List<AtrybutZWartosciami>(); AtrybutZWartosciami temp = null; string[] _category = category.Split(','); foreach (var item2 in _category) { var atrybuty = _repo.PobierzAtrybutyZKategorii(Convert.ToInt16(item2)); foreach (var item in atrybuty) { temp = new AtrybutZWartosciami(); temp.atrybut = item; temp.atrybutWartosc = _repo.PobierzWartosciAtrybutowZAtrybutu(item.Id); ///temp.list = new SelectList(temp.atrybutWartosc, "c"); /// temp.list = _repo.PobierzWartosciAtrybutowZAtrybutuJakoSelect(item.Id); model.Add(temp); } } return View(model); }
public ActionResult WypelnijAtrybuty(string category, string tytul, string nazwa) { List<AtrybutZWartosciami> model = new List<AtrybutZWartosciami>(); AtrybutZWartosciami temp = null; if (category != null) { string[] _category = category.Split(','); foreach (var item2 in _category) { var atrybuty = _repo.PobierzAtrybutyZKategorii(Convert.ToInt16(item2)); foreach (var item in atrybuty) { temp = new AtrybutZWartosciami(); temp.atrybut = item; Ogloszenie ogl = (Ogloszenie)TempData["ogl"]; temp.ogloszenie = ogl; var list = _repo.PobierzWartosciAtrybutowZAtrybutu(item.Id); ///var empty = list.ToList(); temp.atrybutWartosc = list; ///temp.list = new SelectList(temp.atrybutWartosc, "c"); /// temp.list = _repo.PobierzWartosciAtrybutowZAtrybutuJakoSelect(item.Id); //if (empty.Count== 0) // { // continue; // } model.Add(temp); } } if (model.Count == 0) { TempData["Message"] = "Dodano ogłoszenie ! Gratulacje !"; return RedirectToAction("MojeOgloszenia"); } return View(model); } else { return RedirectToAction("MojeOgloszenia"); } }