public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Trade,CompanyEmail,Street,Town,PostalCode,Voivodeship,Country,OwnerID")] Company company) { if (id != company.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(CompanyMapper.MapCompanyToView(company, _context)); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyExists(company.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(company)); }
public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var company = await _context.Companies.SingleOrDefaultAsync(m => m.ID == id); if (company == null) { return(NotFound()); } PrepareVoivodeshipsAndCountires(); return(View(CompanyMapper.MapCompanyToView(company, _context))); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var company = await _context.Companies .SingleOrDefaultAsync(m => m.ID == id); if (company == null) { return(NotFound()); } return(View(CompanyMapper.MapCompanyToView(company, _context))); }