// GET: /Marca/Edit/5 public ActionResult Edit(int id) { MarcaComponent marcaComponent = new MarcaComponent(); return(View(marcaComponent.ReadBy(id))); }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here Marca marca = new Marca(); marca.marca = collection.Get("marca"); MarcaComponent marcaComponent = new MarcaComponent(); if (marcaComponent.Create(marca) == null) { return(RedirectToAction("errorpage", new { id = marcaComponent.ReadBy(marca.marca).Id })); } else { return(RedirectToAction("Index")); } } catch (Exception e) { return(View()); } }
public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here Marca marca = new Marca(); marca.marca = collection.Get("marca"); marca.Id = id; MarcaComponent marcaComponent = new MarcaComponent(); if (marcaComponent.Update(marca)) { return(RedirectToAction("Index")); } else { return(RedirectToAction("errorpage", new { id = marcaComponent.ReadBy(marca.marca).Id })); } } catch (Exception e) { return(View()); } }