public Deportes getById(Deportes a) { deporte = null; try { conexion.Cmd.Connection.Open(); conexion.Cmd.CommandText = "sp_DeporteId "; conexion.Cmd.Parameters.Clear(); conexion.Cmd.Parameters.Add(new SqlParameter("Id", a.DeporteID)); conexion.Cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = conexion.Cmd.ExecuteReader(); if (dr.HasRows) { deporte = mapearObjeto(dr); } //conexion.Cerrar(); dr.Close(); conexion.Cmd.Connection.Close(); } catch (SqlException ex) { conexion.Cmd.Connection.Close(); Logger.Log(ex.Message); } return(deporte); }
public async Task <IActionResult> PutDeportes([FromRoute] int id, [FromBody] Deportes deportes) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deportes.Id) { return(BadRequest()); } _context.Entry(deportes).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeportesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Equipo(string nombre, DirectorTecnico dt, Deportes dep) : this() { this.dt = dt; this.nombre = nombre; this.deporte = dep; }
public ActionResult Edit(Deportes dep) { if (ModelState.IsValid) { db.Entry(dep).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dep)); }
public void Deporte_Invalido() { var deporte = new Deportes() { Name = string.Empty }; var resultado = deporte.EsValido(deporte); Assert.IsFalse(resultado); }
public void Deporte_Valido() { var deporte = new Deportes() { Name = "Natacion" }; var resultado = deporte.EsValido(deporte); Assert.IsTrue(resultado); }
public async Task <IActionResult> PostDeportes([FromBody] Deportes deportes) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Deportes.Add(deportes); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDeportes", new { id = deportes.Id }, deportes)); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(instance); } DontDestroyOnLoad(this); }
public void delete(Deportes a) { try { conexion.Cmd.Connection.Open(); conexion.Cmd.CommandText = "sp_DeporteDel " + a.DeporteID; conexion.Cmd.Parameters.Clear(); conexion.Cmd.CommandType = CommandType.StoredProcedure; conexion.Cmd.ExecuteNonQuery(); //conexion.Cerrar(); conexion.Cmd.Connection.Close(); } catch (SqlException ex) { Logger.Log(ex.Message); } }
public ActionResult Create(Deportes deportes) { if (Session["Adminn"] != null) { if (ModelState.IsValid) { db.Deportes.Add(deportes); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(deportes)); } else { return(Redirect("../Menu/Menu")); } }
public Deportes mapearObjeto(SqlDataReader dr) { while (dr.Read()) { byte[] imagen = null; if (!DBNull.Value.Equals(dr["imagen"])) { imagen = (byte[])dr[3]; } deporte = new Deportes( dr.GetInt16(0), dr.GetString(1), dr.GetString(2), imagen, dr.GetString(4) == "S" ? true : false); } return(deporte); }
public ActionResult Details(int?id) { if (Session["Adminn"] != null) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Deportes dep = db.Deportes.Find(id); if (dep == null) { return(HttpNotFound()); } return(View(dep)); } else { return(Redirect("../Menu/Menu")); } }
public void update(Deportes a) { try { conexion.Cmd.Connection.Open(); conexion.Cmd.CommandText = "sp_DeporteAct "; conexion.Cmd.Parameters.Clear(); conexion.Cmd.Parameters.Add(new SqlParameter("Id", a.DeporteID)); conexion.Cmd.Parameters.Add(new SqlParameter("descripcion", a.Descripcion)); conexion.Cmd.Parameters.Add(new SqlParameter("nombre", a.Nombre)); conexion.Cmd.Parameters.Add(new SqlParameter("imagen", a.Imagen)); conexion.Cmd.Parameters.Add(new SqlParameter("Status", a.Status)); conexion.Cmd.CommandType = CommandType.StoredProcedure; conexion.Cmd.ExecuteNonQuery(); //conexion.Cerrar(); conexion.Cmd.Connection.Close(); } catch (SqlException ex) { Logger.Log(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="nombre"></param> /// <param name="dt"></param> /// <param name="deporte"></param> public Equipo(string nombre, DirectorTecnico dt, Deportes deporte) : this(nombre, dt) { this.Deporte = deporte; }
/// <summary> /// Initialices the team as a soccer team. /// </summary> static Equipo() { deporte = Deportes.Futbol; }
private Equipo() { this.Deporte = Deportes.Futbol; this._jugadores = new List <Jugador>(); }
static Equipo() { Equipo.Deporte = Deportes.Futbol; }
public DeportesDAO() { conexion = new AccesoBD(); deporte = new Deportes(); }
private Equipo() { jugadores = new List <Jugador>(); this.deporte = Deportes.Futbol; }
static Equipo() { _deportes = Deportes.Futbol; }
private Equipo(string nombre, DirectorTecnico dt, Deportes deporte) : this(nombre, dt) { Deportes = deporte; }