Example #1
0
        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);
        }
Example #2
0
        public ActionResult Edit(ManzanaLoteViewModels datos)
        {
            DBManzana dbmanzana = new DBManzana();
            Manzana   manzana   = new Manzana(dbmanzana);

            manzana.Update(datos);
            return(RedirectToAction("Index", "ManzanaLote"));
        }
Example #3
0
        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"));
        }
Example #4
0
 public int Update(ManzanaLoteViewModels datos)
 {
     return(persistence.Update(datos));
 }
Example #5
0
 public int Save(ManzanaLoteViewModels datos)
 {
     return(persistence.Save(datos));
 }