private void dgbEvento_Servicio_CellClick_1(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { Evento_Servicio objEve_Acti = (Evento_Servicio)dgbEvento_Servicio.Rows[e.RowIndex].DataBoundItem; this.cbEvento.SelectedValue = objEve_Acti.id_evento; this.cbServicio.SelectedValue = objEve_Acti.id_servicio; if (dgbEvento_Servicio.Columns[e.ColumnIndex].HeaderText == "Eliminar") { if (MessageBox .Show("¿Está Seguro que desea eliminar la opcion seleccionada?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { MyEvento_ServicioService.EliminarEvento_Servicios(objEve_Acti.id_evento_servicio); this.cargar_evento_Servicio(); } } } }
public ActionResult DeleteConfirmed(int id) { Evento_Servicio evento_Servicio = db.Evento_Servicio.Find(id); db.Evento_Servicio.Remove(evento_Servicio); db.SaveChanges(); return(RedirectToAction("Index")); }
public void CrearEvento_Servicio(Evento_Servicio obj) { using (var dataContext = new Eventos_TPEntitiesContext()) { dataContext.Evento_Servicio.Add(obj); dataContext.SaveChanges(); } }
private void btnRegistrarServicio_Click(object sender, EventArgs e) { Evento_Servicio objEvento_Servicio = new Evento_Servicio(); objEvento_Servicio.id_evento = Convert.ToInt32(cbEvento.SelectedValue); objEvento_Servicio.id_servicio = Convert.ToInt32(cbServicio.SelectedValue); MyEvento_ServicioService.CrearEvento_Servicio(objEvento_Servicio); cargar_evento_Servicio(); MessageBox.Show("El Servicio ha sido guardado!", "Success"); }
public ActionResult Edit([Bind(Include = "id_evento_servicio,id_evento,id_servicio")] Evento_Servicio evento_Servicio) { if (ModelState.IsValid) { db.Entry(evento_Servicio).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_evento = new SelectList(db.Eventoes, "id_evento", "nombre", evento_Servicio.id_evento); ViewBag.id_servicio = new SelectList(db.Servicios, "id_servicio", "nombre", evento_Servicio.id_servicio); return(View(evento_Servicio)); }
public void EliminarEvento_Servicios(int id) { using (var dataContext = new Eventos_TPEntitiesContext()) { var query = from io in dataContext.Evento_Servicio where io.id_evento_servicio == id select io; Evento_Servicio obj = query.FirstOrDefault(); dataContext.Evento_Servicio.Remove(obj); dataContext.SaveChanges(); } }
// GET: Evento_Servicio/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Evento_Servicio evento_Servicio = db.Evento_Servicio.Find(id); if (evento_Servicio == null) { return(HttpNotFound()); } return(View(evento_Servicio)); }
// GET: Evento_Servicio/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Evento_Servicio evento_Servicio = db.Evento_Servicio.Find(id); if (evento_Servicio == null) { return(HttpNotFound()); } ViewBag.id_evento = new SelectList(db.Eventoes, "id_evento", "nombre", evento_Servicio.id_evento); ViewBag.id_servicio = new SelectList(db.Servicios, "id_servicio", "nombre", evento_Servicio.id_servicio); return(View(evento_Servicio)); }
public void CrearEvento_Servicio(Evento_Servicio obj) { Myrepository.CrearEvento_Servicio(obj); }