예제 #1
0
 public static void updateEstadio(Estadio estadio, IDataLink kConnection)
 {
     kConnection.Open();
     var estadioEdit = kConnection.Raw("UPDATE[dbo].[estadios] SET[nombre] = '" + estadio.Nombre + "',[localidad] = '" + estadio.Localidad + "' WHERE id = " + estadio.Id);
     estadioEdit.Execute();
     kConnection.Close();
 }
예제 #2
0
 public static void insertEstadio(Estadio estadio, IDataLink kConnection)
 {
     kConnection.Open();
     var insert = kConnection.Raw("INSERT INTO [dbo].[estadios] ([nombre], [localidad]) VALUES ('"+ estadio.Nombre +"','"+ estadio.Localidad +"')");
     insert.Execute();
     kConnection.Close();
 }
예제 #3
0
 public static object getEstadioById(Estadio estadio, IDataLink kConnection)
 {
     kConnection.Open();
     var estadios = kConnection.Raw("Select * from estadios where id = " + estadio.Id).ToList();
     kConnection.Close();
     return estadios;
 }
예제 #4
0
 public static void deleteEstadio(Estadio estadio, IDataLink kConnection)
 {
     kConnection.Open();
     var data = kConnection.Raw("DELETE FROM [dbo].[estadios] WHERE id = " + estadio.Id);
     data.Execute();
     kConnection.Close();
 }
예제 #5
0
 public ActionResult Create(FormCollection formEstadio)
 {
     try
     {
         var objEstadio = new Estadio
         {
             Nombre = formEstadio["nombre"],
             Localidad = formEstadio["localidad"]
         };
         Estadio.insertEstadio(objEstadio, kConnection);
         return RedirectToAction("Index");
     }
     catch (Exception e)
     {
         return RedirectToAction("Index");
     }
 }
예제 #6
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                var objEstadio = new Estadio
                {
                    Id = id
                };

                Estadio.deleteEstadio(objEstadio, kConnection);
                return RedirectToAction("Index");
            }
            catch (Exception e)
            {
                return RedirectToAction("Index");
            }
        }
예제 #7
0
        // GET: Estadios/Edit/5
        public ActionResult Edit(int id)
        {
            var objEstadio = new Estadio
            {
                Id = id
            };

            ViewBag.estadios = Estadio.getEstadioById(objEstadio, kConnection);
            ViewBag.id = id;
            return View();
        }
예제 #8
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
                var objEstadio = new Estadio
                {
                    Id = id,
                    Nombre = collection["nombre"],
                    Localidad = collection["localidad"]
                };

                Estadio.updateEstadio(objEstadio, kConnection);
                return RedirectToAction("Index");
            }
            catch
            {
                return RedirectToAction("Index");
            }
        }