Пример #1
0
        public async Task <ActionResult> Create([Bind(Include = "Pole_ID,Name,Manager_ID")] Poles poles)
        {
            if (ModelState.IsValid)
            {
                poles.Pole_ID = Guid.NewGuid();
                db.Poles.Add(poles);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.Manager_ID = new SelectList(db.Employees, "Employee_ID", "User_ID", poles.Manager_ID);
            return(View(poles));
        }
Пример #2
0
        public async Task <ActionResult> Create([Bind(Include = "Employee_ID,User_ID,FirstName,LastName,Email,Telephone,Pole_ID")] Employees employees)
        {
            if (ModelState.IsValid)
            {
                employees.Employee_ID = Guid.NewGuid();
                db.Employees.Add(employees);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.User_ID = new SelectList(db.AspNetUsers, "Id", "Email", employees.User_ID);
            ViewBag.Pole_ID = new SelectList(db.Poles, "Pole_ID", "Name", employees.Pole_ID);
            return(View(employees));
        }