Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            MESAS mESAS = db.MESAS.Find(id);

            db.MESAS.Remove(mESAS);
            db.SaveChanges();
            return(RedirectToAction("MesasPorLocal"));
        }
Exemplo n.º 2
0
        // GET: Mesas/Edit/5
        //public ActionResult Edit(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    MESAS mESAS = db.MESAS.Find(id);
        //    if (mESAS == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    ViewBag.Id_Local = new SelectList(db.LOCALES, "Id", "Nombre", mESAS.Id_Local);
        //    return View(mESAS);
        //}

        // POST: Mesas/Edit/5
        // Para protegerse de ataques de publicación excesiva, habilite las propiedades específicas a las que desea enlazarse. Para obtener
        // más información vea https://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Edit([Bind(Include = "Id,Id_Local,Descripcion,Capacidad")] MESAS mESAS)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Entry(mESAS).State = EntityState.Modified;
        //        db.SaveChanges();
        //        return RedirectToAction("MesasPorLocal");
        //    }
        //    ViewBag.Id_Local = new SelectList(db.LOCALES, "Id", "Nombre", mESAS.Id_Local);
        //    return View(mESAS);
        //}

        // GET: Mesas/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MESAS mESAS = db.MESAS.Find(id);

            if (mESAS == null)
            {
                return(HttpNotFound());
            }
            return(View(mESAS));
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id,Id_Local,Descripcion,Capacidad")] MESAS mESAS)
        {
            string correoLocal = User.Identity.GetUserName();
            var    local       = db.LOCALES.Where(e => e.Correo == correoLocal).FirstOrDefault();

            mESAS.Id_Local = local.Id;

            if (ModelState.IsValid)
            {
                db.MESAS.Add(mESAS);
                db.SaveChanges();
                return(RedirectToAction("MesasPorLocal"));
            }

            ViewBag.Id_Local = new SelectList(db.LOCALES, "Id", "Nombre", mESAS.Id_Local);
            return(View(mESAS));
        }