public async Task <IActionResult> Create([Bind("Id,Category")] Categories categories) { if (ModelState.IsValid) { _context.Add(categories); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(categories)); }
public async Task <IActionResult> Create([Bind("Id,CompanyType,Phone,Address1,Address2,City,ZipCode,Name")] Company company) { if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CompanyType"] = new SelectList(_context.Categories, "Id", "Category", company.CompanyType); return(View(company)); }
public async Task <IActionResult> Create([Bind("FirstName,LastName,CompanyId,Id,Address1,Address2,City,Zip")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Company, "Id", "Id", employee.CompanyId); return(View(employee)); }