public ActionResult GetTurno(int IdPlaza) { ConexionController c = new ConexionController(); SqlCommand comandoSql; List <turnos> lista = new List <turnos>(); SqlConnection conexionSQL = new SqlConnection(c.DameConexion(IdPlaza)); try { conexionSQL.Open(); } catch { } try { comandoSql = new SqlCommand("select * from tbl_Turnos"); comandoSql.Connection = conexionSQL; SqlDataReader reader = comandoSql.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { turnos turno = new turnos(); turno.IdTurno = Int32.Parse(reader[0].ToString()); turno.Turno = reader[1].ToString(); lista.Add(turno); } } } catch { } return(Json(lista, JsonRequestBehavior.AllowGet)); }
public bool GuardarTurno(Turnos_VM turnos) { try { using (var contexto = new ControlAlumnosEntities()) { turnos tur = new turnos(); tur.nombre_turno = turnos.nombre_turno; tur.horario_turno = turnos.horario_turno; tur.activo = true; contexto.turnos.Add(tur); contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); throw; } }
public bool EditarTurno(Turnos_VM TurnosId) { try { var Tur = new turnos { idTurno = TurnosId.id }; using (var context = new ControlAlumnosEntities()) { context.turnos.Attach(Tur); Tur.idTurno = TurnosId.id; Tur.nombre_turno = TurnosId.nombre_turno; Tur.horario_turno = TurnosId.horario_turno; Tur.activo = TurnosId.activo; context.Configuration.ValidateOnSaveEnabled = false; context.SaveChanges(); return(true); } } catch (Exception ex) { return(false); throw; } }
public ActionResult Edit(turnos turnos) { try { if (ModelState.IsValid) { db.Entry(turnos).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(turnos)); } catch { return(View(turnos)); } }
public ActionResult Create(turnos turnos) { try { if (ModelState.IsValid) { db.turnos.Add(turnos); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(turnos)); } catch { return(View()); } }
public IHttpActionResult getHorarios() { List <HorarioFijo> lsHorarios = new List <HorarioFijo>(); var horarios = db.horarios_fijos.ToList(); foreach (var h in horarios) { turnos turnoDto = db.turnos.Where(x => x.id == h.id_turno).SingleOrDefault(); HorarioFijo horario = new HorarioFijo(); Turno turno = new Turno(); horario.id_horario = h.id_horario; horario.inicio = h.inicio; horario.fin = h.fin; horario.turno = turno; horario.turno.id = turnoDto.id; horario.turno.descripcion = turnoDto.descripcion; lsHorarios.Add(horario); } return(Ok(lsHorarios)); }
public ActionResult Delete(int?id, turnos turnos) { try { if (ModelState.IsValid) { turnos = db.turnos.Find(id); if (turnos == null) { return(HttpNotFound()); } db.turnos.Remove(turnos); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(turnos)); } catch { return(View(turnos)); } }
void Start() { t = this; turnotxt.text = "fogo"; turno = 1; }