public async Task<IActionResult> Create([Bind("IdEmployee,FirstName,SecondName,LastName,Pesel,IdCardNumber,BirthDate,PhoneNumber,EmailAddress,Login,Password,IdJob,IdManager,IsActive,IdRole")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } ViewData["IdJob"] = new SelectList(_context.Job, "IdJob", "JobName", employee.IdJob); ViewData["IdManager"] = new SelectList(_context.Employee, "IdEmployee", "EmailAddress", employee.IdManager); ViewData["IdRole"] = new SelectList(_context.Role, "IdRole", "RoleName", employee.IdRole); return View(employee); }
public async Task <IActionResult> Create([Bind("IdContract,ContractNumber,Salary,ContractStart,ContractEnd,IdContractType,IdEmployee,IdContractStatus")] Contract contract) { if (ModelState.IsValid) { _context.Add(contract); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdContractStatus"] = new SelectList(_context.ContractStatus, "IdContractStatus", "StatusName", contract.IdContractStatus); ViewData["IdContractType"] = new SelectList(_context.ContractType, "IdContractType", "ContractType1", contract.IdContractType); ViewData["IdEmployee"] = new SelectList(_context.Employee, "IdEmployee", "EmailAddress", contract.IdEmployee); return(View(contract)); }