예제 #1
0
        public ActionResult EditRekord(Tabele.Models.RekordyTabele tableToEdit)
        {
            var originalTable = (from m in _db.RekordyTabele
                                 where m.idRekord == tableToEdit.idRekord
                                 select m).First();

            if (!ModelState.IsValid)
                return View(originalTable);

            _db.ApplyCurrentValues(originalTable.EntityKey.EntitySetName, tableToEdit);
            _db.SaveChanges();
            TempData["message"] = "Poprawnie zedytowano dane";
            return RedirectToAction("Details", new { id = tableToEdit.idTabela, view = 1 });
        }
예제 #2
0
        public ActionResult EditCecha(Tabele.Models.Cechy tableToEdit)
        {
            var originalTable = (from m in _db.Cechy
                                 where m.idCecha == tableToEdit.idCecha
                                 select m).First();

            if (!ModelState.IsValid)
                return View(originalTable);

            _db.ApplyCurrentValues(originalTable.EntityKey.EntitySetName, tableToEdit);
            _db.SaveChanges();
            return RedirectToAction("Cechy");
        }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Tabele EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTabele(Tabele tabele)
 {
     base.AddObject("Tabele", tabele);
 }
예제 #4
0
        public ActionResult Edit(Tabele.Models.Tabele tableToEdit)
        {
            var originalTable = (from m in _db.Tabele
                                 where m.idTabela == tableToEdit.idTabela
                                 select m).First();

            if (!ModelState.IsValid)
                return View(originalTable);

            tableToEdit.dataDodania = originalTable.dataDodania;
            tableToEdit.dataEdycji = DateTime.Now;
            tableToEdit.userId = originalTable.userId;

            _db.ApplyCurrentValues(originalTable.EntityKey.EntitySetName, tableToEdit);
            _db.SaveChanges();
            return RedirectToAction("About");
        }
예제 #5
0
 /// <summary>
 /// Create a new Tabele object.
 /// </summary>
 /// <param name="idTabela">Initial value of the idTabela property.</param>
 /// <param name="nazwa">Initial value of the nazwa property.</param>
 /// <param name="dataDodania">Initial value of the dataDodania property.</param>
 /// <param name="dataEdycji">Initial value of the dataEdycji property.</param>
 /// <param name="userId">Initial value of the userId property.</param>
 public static Tabele CreateTabele(global::System.Int32 idTabela, global::System.String nazwa, global::System.DateTime dataDodania, global::System.DateTime dataEdycji, global::System.Guid userId)
 {
     Tabele tabele = new Tabele();
     tabele.idTabela = idTabela;
     tabele.nazwa = nazwa;
     tabele.dataDodania = dataDodania;
     tabele.dataEdycji = dataEdycji;
     tabele.userId = userId;
     return tabele;
 }