public ActionResult Editar(String id) { ctx = new AlimentoVelozEntities2(); var gnt = ctx.gerente.Find(id); return(View(gnt)); }
public ActionResult DeleteConfirmed(String id) { ctx = new AlimentoVelozEntities2(); if (id != null) { var loc = ctx.locales.Find(id); if (loc != null) { try { ctx.locales.Remove(loc); ctx.SaveChanges(); TempData["shortMessage"] = "Local borrado con Exito"; return(RedirectToAction("ListaLocales")); } catch { TempData["shortMessage"] = "No se pudo completar la operacion"; return(RedirectToAction("ListaLocales")); } } else { TempData["shortMessage"] = "El ID que està tratando de eliminar no existe"; return(RedirectToAction("ListaLocales")); } } else { TempData["shortMessage"] = "El ID que està tratando de eliminar no existe"; return(RedirectToAction("ListaLocales")); } }
public ActionResult Delete(String id) { ctx = new AlimentoVelozEntities2(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var local = ctx.locales.Find(id); var id_local = local.id_local; var repartidores = from c in ctx.repartidor select c; repartidores = repartidores.Where(s => s.id_local.Equals(id_local)); if (repartidores.Count() > 0) { TempData["shortMessage"] = "Existen coincidencias de FKs, debera eliminarlas antes de proceder"; return(RedirectToAction("ListaLocales")); } else { if (local == null) { TempData["shortMessage"] = "El id ya no existe"; return(RedirectToAction("ListaLocales")); } else { return(View(local)); } } }
public ActionResult DeleteConfirmed(String id) { ctx = new AlimentoVelozEntities2(); if (id == null) { TempData["shortMessage"] = "el id no puede ser null o ya no existe"; return(RedirectToAction("Index")); } else { var gnt = ctx.gerente.Find(id); if (gnt == null) { TempData["shortMessage"] = "el id ya no existe"; return(RedirectToAction("Index")); } else { try { ctx.gerente.Remove(gnt); ctx.SaveChanges(); TempData["shortMessage"] = "Gerente eliminado con exito"; return(RedirectToAction("Index")); } catch { TempData["shortMessage"] = "No se pudo completar la operacion"; return(RedirectToAction("Index")); } } } }
public ActionResult Agregar(locales loc) { ctx = new AlimentoVelozEntities2(); var exist = ctx.locales.Find(loc.id_local); var gnt = ctx.gerente.Find(loc.id_gerente); if (exist == null) { if (gnt != null) { ctx = new AlimentoVelozEntities2(); ctx.locales.Add(loc); ctx.SaveChanges(); TempData["shortMessage"] = "Usuario Agregado Exitosamente"; return(RedirectToAction("ListaLocales")); } else { ViewBag.ErrorMessage = "el ID de gerente ingresado no existe"; return(View()); } } else { ViewBag.ErrorMessage = "el ID que está ingresando ya existe"; return(View()); } }
public ActionResult Delete(String id) { ctx = new AlimentoVelozEntities2(); if (id == null) { TempData["shortMessage"] = "El id no puede ser null"; return(RedirectToAction("Index")); } var gnt = ctx.gerente.Find(id); var id_gerente = gnt.id_gerente; var lista = from c in ctx.locales select c; lista = lista.Where(s => s.id_gerente.Equals(id_gerente)); if (lista.Count() > 0) { TempData["shortMessage"] = "Existen coincidencias de FKs, debera eliminarlas antes de proceder"; return(RedirectToAction("ListaLocales")); } else { if (gnt == null) { TempData["shortMessage"] = "El id ya no existe"; return(RedirectToAction("Index")); } else { return(View(gnt)); } } }
public ActionResult Editar(String id) { ctx = new AlimentoVelozEntities2(); var loc = ctx.locales.Find(id); return(View(loc)); }
public ActionResult Editar(String id) { ctx = new AlimentoVelozEntities2(); var pdt = ctx.Productos.Find(id); return(View(pdt)); }
public ActionResult Ubicacion() { ctx = new AlimentoVelozEntities2(); var loc = ctx.locales.ToList(); ViewBag.Message = "Tenemos Locales en :"; return(View(loc)); }
public ActionResult Editar(gerente gnt) { ctx = new AlimentoVelozEntities2(); ctx.Entry(gnt).State = EntityState.Modified; ctx.SaveChanges(); TempData["shortMessage"] = "Guardado Exitoso"; return(RedirectToAction("Index")); }
public ActionResult Editar(locales loc) { ctx = new AlimentoVelozEntities2(); ctx.Entry(loc).State = EntityState.Modified; ctx.SaveChanges(); TempData["shortMessage"] = "Guardado Exitoso"; return(RedirectToAction("ListaLocales")); }
public ActionResult Index(String id) { ctx = new AlimentoVelozEntities2(); var pdt = from c in ctx.Productos select c; if (!String.IsNullOrEmpty(id)) { pdt = pdt.Where(s => s.id_producto.Contains(id)); } return(View(pdt)); }
public ActionResult Listalocales(String id) { ctx = new AlimentoVelozEntities2(); var locales = from c in ctx.locales select c; if (!String.IsNullOrEmpty(id)) { locales = locales.Where(s => s.id_local.Contains(id)); } return(View(locales)); }
public ActionResult Index(String id) { ctx = new AlimentoVelozEntities2(); var gnt = from c in ctx.gerente select c; if (!String.IsNullOrEmpty(id)) { gnt = gnt.Where(s => s.id_gerente.Contains(id)); } return(View(gnt)); }
public ActionResult Index() { ctx = new AlimentoVelozEntities2(); var List = ctx.gerente.ToList(); try { ViewBag.ErrorMessage = TempData["shortMessage"].ToString(); return(View(List)); } catch { return(View(List)); } }
public ActionResult Listalocales() { ctx = new AlimentoVelozEntities2(); var listaLocales = ctx.locales.ToList(); try { ViewBag.ErrorMessage = TempData["shortMessage"].ToString(); return(View(listaLocales)); } catch { return(View(listaLocales)); } }
public ActionResult Details(String id) { ctx = new AlimentoVelozEntities2(); if (id == null || id == "") { TempData["shortMessage"] = "el ID no puede ser null"; return(RedirectToAction("Index")); } var gnt = ctx.gerente.Find(id); if (gnt == null) { TempData["shortMessage"] = "No se encontro el gerente"; return(RedirectToAction("Index")); } return(View(gnt)); }
public ActionResult Agregar(gerente gnt) { ctx = new AlimentoVelozEntities2(); var exist = ctx.gerente.Find(gnt.id_gerente); if (exist == null) { ctx = new AlimentoVelozEntities2(); ctx.gerente.Add(gnt); ctx.SaveChanges(); TempData["shortMessage"] = "Gerente Agregado Exitosamente"; return(RedirectToAction("Index")); } else { ViewBag.ErrorMessage = "el ID que está ingresando ya existe"; return(View()); } }
public ActionResult Delete(String id) { ctx = new AlimentoVelozEntities2(); if (id == null) { TempData["shortMessage"] = "El id no puede ser null"; return(RedirectToAction("Index")); } var pdt = ctx.Productos.Find(id); if (pdt == null) { TempData["shortMessage"] = "El id ya no existe"; return(RedirectToAction("Index")); } else { return(View(pdt)); } }
public ActionResult Details(String id) { ctx = new AlimentoVelozEntities2(); if (id == null || id == "") { TempData["shortMessage"] = "el ID no puede ser null"; return(RedirectToAction("ListaLocales")); } else { } var local = ctx.locales.Find(id); if (local == null) { TempData["shortMessage"] = "No se encontro el local"; return(RedirectToAction("ListaLocales")); } return(View(local)); }