예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,TraingingProgramName,StrateDate,EndDate,Description, MaxNumber")] TrainingProgram trainingProgram)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trainingProgram);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(trainingProgram));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,DepartmentName")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(department));
        }
        public async Task <IActionResult> Create([Bind("Id,ComputerMake,ComputerManufacturer,PurchaseDate")] Computer computer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(computer);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(computer));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,DepartmentId,StartDate")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["DepartmentId"] = new SelectList(_context.Department, "Id", "DepartmentName", employee.DepartmentId);
            return(View(employee));
        }