Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "Id,Nome,Endereco,Cidade,Estado")] Cliente cliente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cliente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cliente));
 }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,Dados,Data,ClienteId")] Contrato contrato)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contrato).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClienteId = new SelectList(db.Clientes, "Id", "Nome", contrato.ClienteId);
     return(View(contrato));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Nome,EnderecoInstalacao,DataInstalacao,ContratoId")] Alarme alarme)
 {
     if (ModelState.IsValid)
     {
         db.Entry(alarme).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ContratoId = new SelectList(db.Contratos, "Id", "Dados", alarme.ContratoId);
     return(View(alarme));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,Numero,Nome,AlarmeId")] Zona zona)
 {
     if (ModelState.IsValid)
     {
         db.Entry(zona).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AlarmeId = new SelectList(db.Alarmes, "Id", "Nome", zona.AlarmeId);
     return(View(zona));
 }
 public ActionResult Edit([Bind(Include = "EmployeeId,Gender,City,DepartmentId")] Employee employee)
 //Tirei Name do Bind acima
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employee.DepartmentId);
     return(View(employee));
 }