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("Name,Passport,Year,Id,Education")] Employer employer) { if (ModelState.IsValid) { _context.Add(employer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employer)); }
public async Task <IActionResult> Create([Bind("Name,Year,Id")] ItCompany itCompany) { if (ModelState.IsValid) { _context.Add(itCompany); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(itCompany)); }
public async Task <IActionResult> Create([Bind("Id,Position")] EmpPosition empPosition) { if (ModelState.IsValid) { _context.Add(empPosition); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(empPosition)); }
public async Task <IActionResult> Create([Bind("Name,Year,Budget,ItCompanyId,Id")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ItCompanyId"] = new SelectList(_context.ItCompanies, "Id", "Name", product.ItCompanyId); return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,Name,OfficeId")] Subdivision subdivision) { if (ModelState.IsValid) { _context.Add(subdivision); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OfficeId"] = new SelectList(_context.Offices, "Id", "Address", subdivision.OfficeId); return(View(subdivision)); }
public async Task <IActionResult> Create([Bind("Id,CityId,Square,Address,ItCompanyId")] Office office) { if (ModelState.IsValid) { _context.Add(office); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Name", office.CityId); ViewData["ItCompanyId"] = new SelectList(_context.ItCompanies, "Id", "Name", office.ItCompanyId); return(View(office)); }
public async Task <IActionResult> Create([Bind("Id,Salary,PositionId,SubdivisionId,EmployerId")] EmpSub empSub) { if (ModelState.IsValid) { _context.Add(empSub); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployerId"] = new SelectList(_context.Employers, "Id", "Name", empSub.EmployerId); ViewData["PositionId"] = new SelectList(_context.Positions, "Id", "Position", empSub.PositionId); ViewData["SubdivisionId"] = new SelectList(_context.Subdivisions, "Id", "Name", empSub.SubdivisionId); return(View(empSub)); }
public async Task <IActionResult> Create(int countryId, [Bind("Id,Name")] City city) { city.CountryId = countryId; if (ModelState.IsValid) { _context.Add(city); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); return(RedirectToAction("Index", "Cities", new { id = countryId, name = _context.Countries.Where(c => c.Id == countryId).FirstOrDefault().Name })); } //ViewData["CountryId"] = new SelectList(_context.Countries, "Id", "Name", city.CountryId); //return View(city); return(RedirectToAction("Index", "Cities", new { id = countryId, name = _context.Countries.Where(c => c.Id == countryId).FirstOrDefault().Name })); }