public ActionResult Create([Bind(Include = "IdCliente,NombreCliente")] Cliente cliente) { if (ModelState.IsValid) { db.Cliente.Add(cliente); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cliente)); }
public ActionResult Create([Bind(Include = "IdParametros,Descripcion,Parametro,Valor")] Parametros parametros) { if (ModelState.IsValid) { db.Parametros.Add(parametros); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(parametros)); }
public ActionResult Edit([Bind(Include = "IdMovimiento,IdCuenta,Fecha,ValorRetiro,ValorGmf,SaldoMov,CuentaDestino,TipoTransaccion")] Movimientos movimientos) { if (ModelState.IsValid) { db.Entry(movimientos).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdCuenta = new SelectList(db.Cuentas, "IdCuenta", "NombreCta", movimientos.IdCuenta); return(View(movimientos)); }
public ActionResult Create([Bind(Include = "IdCuenta,NombreCta,Excento,Banco,IdCliente,Saldo")] Cuentas cuentas) { if (ModelState.IsValid) { db.Cuentas.Add(cuentas); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdCliente = new SelectList(db.Cliente, "IdCliente", "NombreCliente", cuentas.IdCliente); return(View(cuentas)); }
public void TestWipeDataDatabase1Ok() { //SETUP var options = this.CreateUniqueMethodOptions <DbContext1>(); using (var context = new DbContext1(options)) { context.Database.EnsureCreated(); context.Add(new TopClass1 { Dependents = new List <Dependent1> { new Dependent1() } }); context.SaveChanges(); context.TopClasses.Count().ShouldEqual(1); context.Dependents.Count().ShouldEqual(1); //ATTEMPT context.Database.EnsureClean(); //VERIFY context.TopClasses.Count().ShouldEqual(0); context.Dependents.Count().ShouldEqual(0); } }
public void TestEnsureDeletedThenCreateDatabase1Ok() { //SETUP var showLog = false; #pragma warning disable 618 var options = this.CreateUniqueClassOptionsWithLogging <DbContext1>(log => #pragma warning restore 618 { if (showLog) { _output.WriteLine(log.Message); } }); using (var context = new DbContext1(options)) { context.Database.EnsureDeleted(); //ATTEMPT showLog = true; context.Database.EnsureClean(); showLog = false; //VERIFY context.Add(new TopClass1()); context.SaveChanges(); } }
//function to save changes on DataBase public void SaveChanges() { DataBase.SaveChanges(); }