public List <ob_gpeli> Todos_gpelis() { listausu.Clear(); DataTable dt = cdusu.mostrar_gpelis(); foreach (DataRow dr in dt.Rows) { ob_gpeli gpeli = new ob_gpeli(); gpeli.gen_id = Convert.ToInt32(dr["gen_id"].ToString()); gpeli.pel_id = Convert.ToInt32(dr["pel_id"].ToString()); listausu.Add(gpeli); } return(listausu); }
// metodo de ingreso public IHttpActionResult GetGpeli(string gen_id) { try { obs = cn_usu.buscarxgpeli(gen_id); ob_gpeli[] lisus2 = new ob_gpeli[] { new ob_gpeli { gen_id = obs.gen_id, pel_id = obs.pel_id } }; return(Ok(lisus2)); } catch (Exception) { HttpResponseMessage mensaje = new HttpResponseMessage(); return(Ok(mensaje)); } }
public ob_gpeli buscarxgpeli(string gpel) { ob_gpeli us = new ob_gpeli(); cd_gpeli cda = new cd_gpeli(); us = cda.buscarxgpeli(gpel); if (us.gen_id != 0) { return(us); } else { ob_gpeli sinna = new ob_gpeli(); sinna.gen_id = 0; sinna.pel_id = 0; return(sinna); } }