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)); }
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)); }
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); } }
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); } }
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)); }
public MarcaProductos UpdateMarca(MarcaProductos marca) { return(new MarcaProductosDa().Update(marca)); }
public MarcaProductos InsertMarca(MarcaProductos marca) { return(new MarcaProductosDa().Insert(marca)); }