public async Task <IActionResult> Edit(int id, [Bind("DifferentRelayId,ManufacturersName,CountryOfOrigin,ManufacturersModelNo,RelayTypeId")] LookUpDifferentRelay lookUpDifferentRelay) { if (id != lookUpDifferentRelay.DifferentRelayId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lookUpDifferentRelay); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LookUpDifferentRelayExists(lookUpDifferentRelay.DifferentRelayId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RelayTypeId"] = new SelectList(_context.LookUpDifferentTypesOfRelay, "RelayTypeId", "RelayTypeName", lookUpDifferentRelay.RelayTypeId); return(View(lookUpDifferentRelay)); }
public async Task <IActionResult> Create([Bind("DifferentRelayId,ManufacturersName,CountryOfOrigin,ManufacturersModelNo,RelayTypeId")] LookUpDifferentRelay lookUpDifferentRelay) { if (ModelState.IsValid) { _context.Add(lookUpDifferentRelay); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["RelayTypeId"] = new SelectList(_context.LookUpDifferentTypesOfRelay, "RelayTypeId", "RelayTypeName", lookUpDifferentRelay.RelayTypeId); return(View(lookUpDifferentRelay)); }