Esempio n. 1
0
        public ActionResult Create([Bind(Include = "CompanyID,CompanyName,ZipCode")] Company company)
        {
            if (ModelState.IsValid)
            {
                db.Companies.Add(company);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(company));
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "EmployeeID,CompanyID,EmployeeName,EmployeeEmail,Position,Interest1,Interest2,Interest3,Cuisine1,Cuisine2,Cuisine3")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CompanyID = new SelectList(db.Companies, "CompanyID", "CompanyName", employee.CompanyID);
            return(View(employee));
        }