public bool AgregarServicio(string plato, int precio, string tipoServicio) { ServiceServicioComedor ssc = new ServiceServicioComedor(); ServiceTipoServicio sts = new ServiceTipoServicio(); try { // Servicio TIPOSERVICIO ts = sts.getEntityDesc(tipoServicio); SERVICIOCOMEDOR sc = new SERVICIOCOMEDOR(); sc.IDSERVICIO = ssc.id(); sc.PLATO = plato; sc.PRECIO = precio; sc.TIPOSERVICIO = ts.IDTIPO; sc.IDADMINISTRADOR = 1; if (sc.PRECIO >= 0) { ssc.addEntity(sc); MessageBox.Show("Servicio Agregado.", "Agregar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(true); } else { MessageBox.Show("El precio debe ser mayor o igual a 0.", "Agregar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } catch (Exception ex) { MessageBox.Show("No se pudo crear el servicio.", "Crear Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public bool ModificarServicio(int id, string plato, int precio, string tiposervicio) { ServiceServicioComedor ssc = new ServiceServicioComedor(); ServiceTipoServicio sts = new ServiceTipoServicio(); TIPOSERVICIO ts = sts.getEntityDesc(tiposervicio); SERVICIOCOMEDOR sc = new SERVICIOCOMEDOR(); sc.IDSERVICIO = id; sc.PLATO = plato; sc.PRECIO = precio; sc.TIPOSERVICIO = ts.IDTIPO; if (sc.PRECIO >= 0) { ssc.updEntity(sc); MessageBox.Show("Servicio Modificado.", "Modificar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(true); } else { MessageBox.Show("El precio debe ser mayor o igual a 0.", "Agregar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public ActionResult DeleteConfirmed(int id) { TIPOSERVICIO tIPOSERVICIO = db.TIPOSERVICIOS.Find(id); db.TIPOSERVICIOS.Remove(tIPOSERVICIO); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(decimal id) { TIPOSERVICIO tIPOSERVICIO = await db.TIPOSERVICIO.FindAsync(id); db.TIPOSERVICIO.Remove(tIPOSERVICIO); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,acronimo,descripcion")] TIPOSERVICIO tIPOSERVICIO) { if (ModelState.IsValid) { db.Entry(tIPOSERVICIO).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tIPOSERVICIO)); }
public async Task <ActionResult> Edit([Bind(Include = "ID,DESCRIPCION")] TIPOSERVICIO tIPOSERVICIO) { if (ModelState.IsValid) { db.Entry(tIPOSERVICIO).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tIPOSERVICIO)); }
public ActionResult Create([Bind(Include = "id,acronimo,descripcion")] TIPOSERVICIO tIPOSERVICIO) { if (ModelState.IsValid) { db.TIPOSERVICIOS.Add(tIPOSERVICIO); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tIPOSERVICIO)); }
public async Task <ActionResult> Create([Bind(Include = "ID,DESCRIPCION")] TIPOSERVICIO tIPOSERVICIO) { if (ModelState.IsValid) { db.TIPOSERVICIO.Add(tIPOSERVICIO); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tIPOSERVICIO)); }
// GET: AreaConfiguracion/TIPOSERVICIO/Delete/5 public async Task <ActionResult> Delete(decimal id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TIPOSERVICIO tIPOSERVICIO = await db.TIPOSERVICIO.FindAsync(id); if (tIPOSERVICIO == null) { return(HttpNotFound()); } return(View(tIPOSERVICIO)); }
// GET: TipoServicios/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TIPOSERVICIO tIPOSERVICIO = db.TIPOSERVICIOS.Find(id); if (tIPOSERVICIO == null) { return(HttpNotFound()); } return(View(tIPOSERVICIO)); }