// GET: Items/Edit/5 public async Task <IActionResult> Edit(string id) { if (id == null) { return(NotFound()); } var item = await service.FindItemAsync(id); if (item == null) { return(NotFound()); } ViewData["ColorId"] = new SelectList(service.GetAllItemColorsAsync().Result, "Id", "Name", item.ColorId); ViewData["ItemTypeId"] = new SelectList(service.GetAllItemTypesAsync().Result, "Id", "Name", item.ItemTypeId); return(View(item)); }