public async Task <IActionResult> Create([Bind("Id,Designation1,Code")] Designation designation) { if (ModelState.IsValid) { _context.Add(designation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(designation)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Country country) { if (ModelState.IsValid) { _context.Add(country); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Code,CountryId,DesignationId")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Country, "Id", "Id", employee.CountryId); ViewData["DesignationId"] = new SelectList(_context.Designation, "Id", "Id", employee.DesignationId); return(View(employee)); }