public ActionResult Create(moradores collection) { try { Condominios controleCondominio = new Condominios(); // TODO: Add insert logic here string[] s = Request.Params.GetValues("condominios"); List <condominio> lista = new List <condominio>(); foreach (string str in s) { lista.Add(controleCondominio.RetornaItem(Convert.ToInt32(str))); } int id = controle.AdicionaMorador(collection); controle.Salvacondominios(lista, id); return(RedirectToAction("Index")); } catch { return(View()); } }