public async Task <IActionResult> Edit(int id, [Bind("Id,ModelId,ParameterId,Value")] DeviceModelParameter deviceModelParameter) { if (id != deviceModelParameter.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(deviceModelParameter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeviceModelParameterExists(deviceModelParameter.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ModelId"] = new SelectList(_context.DeviceModel, "Id", "Id", deviceModelParameter.ModelId); ViewData["ParameterId"] = new SelectList(_context.DeviceParameter, "Id", "Id", deviceModelParameter.ParameterId); return(View(deviceModelParameter)); }
public async Task <IActionResult> Create([Bind("Id,ModelId,ParameterId,Value")] DeviceModelParameter deviceModelParameter) { if (ModelState.IsValid) { _context.Add(deviceModelParameter); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ModelId"] = new SelectList(_context.DeviceModel, "Id", "Name", deviceModelParameter.ModelId); ViewData["ParameterId"] = new SelectList(_context.DeviceParameter, "Id", "Name", deviceModelParameter.ParameterId); return(View(deviceModelParameter)); }