public async Task <IActionResult> Edit(int id, [Bind("Id,Types,Roboticsprinciples,Modesoflocomotion")] TypesInRelation typesInRelation) { if (id != typesInRelation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(typesInRelation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypesInRelationExists(typesInRelation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["Modesoflocomotion"] = new SelectList(_context.ModesOfLocomotion, "Id", "Id", typesInRelation.Modesoflocomotion); ViewData["Roboticsprinciples"] = new SelectList(_context.RoboticsPrinciples, "Id", "Id", typesInRelation.Roboticsprinciples); ViewData["Types"] = new SelectList(_context.Types, "Id", "Id", typesInRelation.Types); return(View(typesInRelation)); }
public async Task <IActionResult> Create([Bind("Id,Types,Roboticsprinciples,Modesoflocomotion")] TypesInRelation typesInRelation) { if (ModelState.IsValid) { _context.Add(typesInRelation); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["Modesoflocomotion"] = new SelectList(_context.ModesOfLocomotion, "Id", "Id", typesInRelation.Modesoflocomotion); ViewData["Roboticsprinciples"] = new SelectList(_context.RoboticsPrinciples, "Id", "Id", typesInRelation.Roboticsprinciples); ViewData["Types"] = new SelectList(_context.Types, "Id", "Id", typesInRelation.Types); return(View(typesInRelation)); }