public object FindForId(int id) { var lotemanzana = new ManzanaLoteViewModels(); string query = " SELECT id, manzana FROM manzana WHERE id = " + id; using (var connection = PostConnection.Connection()) { using (var command = db.Command(query)) { try { connection.Open(); command.Connection = connection; using (var reader = command.ExecuteReader()) { while (reader.Read()) { lotemanzana.id = Convert.ToInt32(reader["id"]); lotemanzana.manzana = reader["manzana"].ToString(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } return(lotemanzana); }
public ActionResult Edit(ManzanaLoteViewModels datos) { DBManzana dbmanzana = new DBManzana(); Manzana manzana = new Manzana(dbmanzana); manzana.Update(datos); return(RedirectToAction("Index", "ManzanaLote")); }
public ActionResult Create(ManzanaLoteViewModels datos) { ViewBag.Title = "Ingresar Manzana"; DBManzana dbmanzana = new DBManzana(); Manzana manzana = new Manzana(dbmanzana); manzana.Save(datos); return(RedirectToAction("Index", "ManzanaLote")); }
public int Update(ManzanaLoteViewModels datos) { return(persistence.Update(datos)); }
public int Save(ManzanaLoteViewModels datos) { return(persistence.Save(datos)); }