예제 #1
0
        public async Task <IActionResult> Create([Bind("EmployeeId,NationalCode,ProsonnelCode,FullName,ChildCount")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                if (await _userServices.NationalCodeIsExist(employee.NationalCode) ||
                    await _userServices.PersonalCodeIsExist(employee.ProsonnelCode))
                {
                    ViewData["IsExist"] = "true";
                    return(View(employee));
                }
                else
                {
                    await _userServices.AddEmployee(employee);

                    return(RedirectToAction("Index"));
                }
            }
            return(View(employee));
        }