public JsonResult LeeDesarrollosAsignados(int ZonaID) { try { List <ZonaEP> listZona = new List <ZonaEP>(); var result = from x in db.ZonaEP where x.ZonaId == ZonaID select x; foreach (var item in result) { ZonaEP zonaEP = new ZonaEP(); zonaEP.ZonaEPId = item.ZonaEPId; zonaEP.EPId = item.EPId; zonaEP.ZonaId = item.ZonaId; listZona.Add(zonaEP); } return(Json(listZona, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(Json(null, JsonRequestBehavior.AllowGet)); } }
private bool AgregaDesarrollo(int EPID, int ZonaID) { try { ZonaEP zonaEP = new ZonaEP(); zonaEP.EPId = EPID; zonaEP.ZonaId = ZonaID; db.ZonaEP.Add(zonaEP); db.SaveChanges(); return(true); } catch (Exception) { return(false); } }