コード例 #1
0
        public async Task <IActionResult> Create([Bind("DepartmentID,DepartmentName,Description")] DepartmentModel departmentModel)
        {
            if (ModelState.IsValid)
            {
                _tempContext.Add(departmentModel);
                await _tempContext.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departmentModel));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("EmployeeID,Name,Surname,Address,Qualification,Contact,DepartmentName")] EmployeeModel employeeModel)
        {
            if (ModelState.IsValid)
            {
                _tempContext.Add(employeeModel);
                await _tempContext.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeModel));
        }