Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdMarca,MarcaProducto")] MarcaProductos marcaProductos)
        {
            if (id != marcaProductos.IdMarca)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(marcaProductos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MarcaProductosExists(marcaProductos.IdMarca))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(marcaProductos));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("IdMarca,MarcaProducto")] MarcaProductos marcaProductos)
        {
            if (ModelState.IsValid)
            {
                _context.Add(marcaProductos);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(marcaProductos));
        }
Ejemplo n.º 3
0
 public MarcaProductos Update(MarcaProductos item)
 {
     try
     {
         _sisGmaEntities.Entry(item).State = EntityState.Modified;
         _sisGmaEntities.SaveChanges();
         return(item);
     }
     catch (EntryPointNotFoundException ep)
     {
         IsValid      = false;
         ErrorMessage = ep.GetBaseException().Message;
         return(null);
     }
     catch (Exception e)
     {
         IsValid      = false;
         ErrorMessage = e.GetBaseException().Message;
         return(null);
     }
 }
Ejemplo n.º 4
0
 public MarcaProductos Insert(MarcaProductos item)
 {
     try
     {
         _sisGmaEntities.MarcaProductos.Add(item);
         _sisGmaEntities.SaveChanges();
         return(item);
     }
     catch (EntryPointNotFoundException ep)
     {
         IsValid      = false;
         ErrorMessage = ep.GetBaseException().Message;
         return(null);
     }
     catch (Exception e)
     {
         IsValid      = false;
         ErrorMessage = e.GetBaseException().Message;
         return(null);
     }
 }
Ejemplo n.º 5
0
        public JsonResult GuardarMarca(int idMarca, string marca, string estado)
        {
            bool response;
            var  inventarioBo = new InventarioBo();
            var  dataMarca    = new MarcaProductos
            {
                IdMarca = idMarca,
                Marca   = marca,
                Estado  = "true".Equals(estado.ToLower())
            };

            if (idMarca > 0)
            {
                response = inventarioBo.UpdateMarca(dataMarca).IdMarca > 0;
            }
            else
            {
                response = inventarioBo.InsertMarca(dataMarca).IdMarca > 0;
            }

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
 public MarcaProductos UpdateMarca(MarcaProductos marca)
 {
     return(new MarcaProductosDa().Update(marca));
 }
Ejemplo n.º 7
0
 public MarcaProductos InsertMarca(MarcaProductos marca)
 {
     return(new MarcaProductosDa().Insert(marca));
 }