public async Task <ActionResult> Create([Bind(Include = "EmployeeID,FirstName,LastName,Title,EmailAddress,DepartmentName")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Sku,Details,ImagePath,Notes,CategoryId")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(db.Categorys, "Id", "Description", product.CategoryId);
            return(View(product));
        }