public async Task <IActionResult> EditChannel([Bind("ID,FunctionTemplateRefID,ColorKeyId,ValueRangeFrom,ValueRangeTo")] FunctionTemplateChannel functionTemplateChannel) { if (ModelState.IsValid) { FunctionTemplateChannel temp = await _context.FindAsync <FunctionTemplateChannel>(functionTemplateChannel.ID); if (temp == null) { return(NotFound()); } temp.ColorKeyId = functionTemplateChannel.ColorKeyId; temp.ValueRangeFrom = functionTemplateChannel.ValueRangeFrom; temp.ValueRangeTo = functionTemplateChannel.ValueRangeTo; temp.Channel = functionTemplateChannel.Channel; _context.Update(temp); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } // ensure model is fully filled if (functionTemplateChannel.FunctionTemplate == null) { // load dependend Data //_context.Entry(functionTemplateChannel) ViewData["ColorKeyID"] = new SelectList(_context.ColorKeys, "ColorID", "ColorName", functionTemplateChannel.ColorKeyId); } return(View(functionTemplateChannel)); }