public ActionResult Create([Bind(Include = "Id,Nome,Endereco,Cidade,Estado")] Cliente cliente)
        {
            if (ModelState.IsValid)
            {
                db.Clientes.Add(cliente);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(cliente));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "Id,Dados,Data,ClienteId")] Contrato contrato)
        {
            if (ModelState.IsValid)
            {
                db.Contratos.Add(contrato);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClienteId = new SelectList(db.Clientes, "Id", "Nome", contrato.ClienteId);
            return(View(contrato));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "Id,Nome,EnderecoInstalacao,DataInstalacao,ContratoId")] Alarme alarme)
        {
            if (ModelState.IsValid)
            {
                db.Alarmes.Add(alarme);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ContratoId = new SelectList(db.Contratos, "Id", "Dados", alarme.ContratoId);
            return(View(alarme));
        }
        public ActionResult Create([Bind(Include = "EmployeeId,Name,Gender,City,DepartmentId")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employee.DepartmentId);
            return(View(employee));
        }
        public ActionResult Create([Bind(Include = "Id,Numero,Nome,AlarmeId")] Zona zona)
        {
            if (ModelState.IsValid)
            {
                db.Zonas.Add(zona);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AlarmeId = new SelectList(db.Alarmes, "Id", "Nome", zona.AlarmeId);
            return(View(zona));
        }