public virtual void Delete(TEntity entityToDelete)
 {
     if (context.Entry(entityToDelete).State == EntityState.Detached)
     {
         dbSet.Attach(entityToDelete);
     }
     dbSet.Remove(entityToDelete);
 }
Example #2
0
        public async Task <IActionResult> Check(long id)
        {
            var documento = await _context.Documento
                            .Select(d => new Documento
            {
                Id = d.Id
            })
                            .FirstOrDefaultAsync(m => m.Id == id);

            if (documento == null)
            {
                return(NotFound());
            }
            documento.FechaRevisado = DateTime.Now;
            _context.Entry(documento).Property(x => x.FechaRevisado).IsModified = true;
            _context.SaveChanges();
            return(RedirectToAction(nameof(Index)));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "Id,Nombre,Direccion,CodigoPostal,Telefono,CorreoElectronico")] Proveedores proveedores)
 {
     if (ModelState.IsValid)
     {
         db.Entry(proveedores).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(proveedores));
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "ID,Nombre")] Categorias categorias)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categorias).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(categorias));
 }
 public ActionResult Edit([Bind(Include = "VentaID,Producto,FechaVenta")] Ventas ventas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ventas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Producto = new SelectList(db.Productos, "ProductoId", "Nombre", ventas.Producto);
     return(View(ventas));
 }
 public ActionResult Edit([Bind(Include = "ProductoId,Nombre,Descripcion,Precio,Categoria,Proveedor,FechaIngreso")] Productos productos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Categoria = new SelectList(db.Categorias, "ID", "Nombre", productos.Categoria);
     ViewBag.Proveedor = new SelectList(db.Proveedores, "Id", "Nombre", productos.Proveedor);
     return(View(productos));
 }