public IHttpActionResult PostADMINISTRADOR(ADMINISTRADOR aDMINISTRADOR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ADMINISTRADOR.Add(aDMINISTRADOR); try { db.SaveChanges(); } catch (DbUpdateException) { if (ADMINISTRADORExists(aDMINISTRADOR.Cedula)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = aDMINISTRADOR.Cedula }, aDMINISTRADOR)); }
public IHttpActionResult PutADMINISTRADOR(int id, ADMINISTRADOR aDMINISTRADOR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aDMINISTRADOR.Cedula) { return(BadRequest()); } db.Entry(aDMINISTRADOR).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ADMINISTRADORExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { ADMINISTRADOR aDMINISTRADOR = db.ADMINISTRADOR.Find(id); db.ADMINISTRADOR.Remove(aDMINISTRADOR); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,USERNAME,CLAVE")] ADMINISTRADOR aDMINISTRADOR) { if (ModelState.IsValid) { db.Entry(aDMINISTRADOR).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(aDMINISTRADOR)); }
/// <summary> /// Este metodo se encarga de colsultar y verificar que los datos de autenticacion del /// adimistrador sean correctos /// </summary> /// <param name="correo">Correo del administrador</param> /// <param name="contraseña">Contraseña del administrador</param> /// <returns>Retorna Verdadero si el correo y la contraseña son correctos, en /// caso contrario retorna false</returns> private bool buscarAdministrador(string correo, string contraseña) { ADMINISTRADOR administradorDB = repositorio.consultarAdministrador(correo); if (administradorDB != null) { return(controladoraRCatador.VerificarMd5Hash(contraseña, administradorDB.CONTRASEÑA)); } return(false); }
public ActionResult Create([Bind(Include = "ID,USERNAME,CLAVE")] ADMINISTRADOR aDMINISTRADOR) { if (ModelState.IsValid) { db.ADMINISTRADOR.Add(aDMINISTRADOR); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(aDMINISTRADOR)); }
public IHttpActionResult GetADMINISTRADOR(int id) { ADMINISTRADOR aDMINISTRADOR = db.ADMINISTRADOR.Find(id); if (aDMINISTRADOR == null) { return(NotFound()); } return(Ok(aDMINISTRADOR)); }
// GET: ADMINISTRADOR/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ADMINISTRADOR aDMINISTRADOR = db.ADMINISTRADOR.Find(id); if (aDMINISTRADOR == null) { return(HttpNotFound()); } return(View(aDMINISTRADOR)); }
public IHttpActionResult DeleteADMINISTRADOR(int id) { ADMINISTRADOR aDMINISTRADOR = db.ADMINISTRADOR.Find(id); if (aDMINISTRADOR == null) { return(NotFound()); } db.ADMINISTRADOR.Remove(aDMINISTRADOR); db.SaveChanges(); return(Ok(aDMINISTRADOR)); }