Beispiel #1
0
        public ActionResult Editar(Despacho e)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                using (var db = new GestionDeAlmacenContext())
                {
                    Despacho cl = db.Despacho.Find(e.id);
                    cl.fecha                = e.fecha;
                    cl.tipo_de_acciom       = e.tipo_de_acciom;
                    cl.producto             = e.producto;
                    cl.clientes             = e.clientes;
                    cl.contactos            = e.contactos;
                    cl.Detalle_de_productos = e.Detalle_de_productos;
                    cl.cant_producto        = e.cant_producto;

                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #2
0
        public ActionResult Editar(clientes e)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                using (var db = new GestionDeAlmacenContext())
                {
                    clientes cl = db.clientes.Find(e.codigo);
                    cl.nombre          = e.nombre;
                    cl.apellido        = e.apellido;
                    cl.telefono        = e.telefono;
                    cl.direccion       = e.direccion;
                    cl.correo          = e.correo;
                    cl.tipo_de_cliente = e.tipo_de_cliente;
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #3
0
        public ActionResult Editar(producto e)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                using (var db = new GestionDeAlmacenContext())
                {
                    producto cl = db.producto.Find(e.codigo);
                    cl.fecha_de_creacion = e.fecha_de_creacion;
                    cl.fecha_vencimiento = e.fecha_vencimiento;
                    cl.nombre            = e.nombre;
                    cl.Descripcion       = e.Descripcion;
                    cl.UdM        = e.UdM;
                    cl.Costo      = e.Costo;
                    cl.Existencia = e.Existencia;
                    cl.Estado     = e.Estado;
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
 public ActionResult Detalles(int id)
 {
     using (var db = new GestionDeAlmacenContext())
     {
         Despacho cl4 = db.Despacho.Find(id);
         return(View(cl4));
     }
 }
Beispiel #5
0
 public ActionResult Detalles(int id)
 {
     using (var db = new GestionDeAlmacenContext())
     {
         clientes cl4 = db.clientes.Find(id);
         return(View(cl4));
     }
 }
Beispiel #6
0
 public ActionResult Eliminar(int id)
 {
     using (var db = new GestionDeAlmacenContext())
     {
         Despacho cl = db.Despacho.Find(id);
         db.Despacho.Remove(cl);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
Beispiel #7
0
 public ActionResult Eliminar(int id)
 {
     using (var db = new GestionDeAlmacenContext())
     {
         clientes cl4 = db.clientes.Find(id);
         db.clientes.Remove(cl4);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
Beispiel #8
0
 // GET: despacho
 public ActionResult Index()
 {
     try
     {
         using (var db = new GestionDeAlmacenContext())
         {
             return(View(db.Despacho.ToList()));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #9
0
 public ActionResult Editar(int id)
 {
     try
     {
         using (var db = new GestionDeAlmacenContext())
         {
             //Cliente cl = db.Cliente.Where(a => a.codigo == id).FirstOrDefault();
             Despacho cl = db.Despacho.Find(id);
             return(View(cl));
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #10
0
 public ActionResult Agregar(Despacho d)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     try
     {
         using (var db = new GestionDeAlmacenContext())
         {
             db.Despacho.Add(d);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("error al crear", ex);
         return(View());
     }
 }