Пример #1
0
 public ActionResult Edit(Ticket ticket)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ticket).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ticket));
 }
Пример #2
0
 public ActionResult Edit([Bind(Include = "TicketID,EventTitle,TicketRow,TicketColumn")] TicketModel ticketmodel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ticketmodel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ticketmodel));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Description,Price,Quantity,Category")] Ticket ticket)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ticket).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ticket));
 }
Пример #4
0
        public async Task <ActionResult> Edit([Bind(Include = "IdCatalogo,Nombre,Genero,Precio,HoraInicio,HoraFin,Asientos")] Catalogo catalogo)
        {
            if (ModelState.IsValid)
            {
                db.Entry(catalogo).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(catalogo));
        }
Пример #5
0
        public async Task <ActionResult> Edit([Bind(Include = "IdVenta,Fecha,IdCatalogo,Asientos,procede,TipoPago,Cobrado,Empleado")] Venta venta)
        {
            venta.Fecha = DateTime.Now.Date;
            var empleado = User.Identity.Name;

            if (empleado.Length < 1)
            {
                empleado = "Anonimo";
            }
            venta.Empleado = empleado;

            try
            {
                Catalogo catal = await db.Catalogos.FindAsync(venta.IdCatalogo);

                decimal precio   = catal.Precio;
                decimal asientos = (decimal)venta.Asientos;
                var     cobrado  = precio * asientos;
                if (venta.Asientos > 0)
                {
                    if (precio > 0)
                    {
                        venta.Cobrado = ((double)cobrado);
                    }
                }
            }
            catch (Exception) { }
            if (ModelState.IsValid)
            {
                db.Entry(venta).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.IdCatalogo = new SelectList(db.Catalogos, "IdCatalogo", "Nombre", venta.IdCatalogo);
            return(View(venta));
        }