//Método para carregar o DropDown de times public JsonResult CarregarTimes() { try { TimeDal d = new TimeDal(); var list = new List<TimeModelDropDown>(); foreach (Time t in d.FindAll()) { var model = new TimeModelDropDown(); model.IdTime = t.IdTime; model.Nome = t.Nome; list.Add(model); } return Json(list); } catch (Exception e) { return Json(e.Message); } }
public JsonResult CarregarTimes() { try { var list = new List<TimeModelDropDown>(); foreach (Time t in appTime.ListarTodos()) { var model = new TimeModelDropDown(); model.IdTime = t.IdTime; model.Nome = t.Nome; list.Add(model); } return Json(list, JsonRequestBehavior.AllowGet); } catch (Exception e) { return Json(e.Message); } }