public async Task <IActionResult> Edit(int id, [Bind("Id,Roboticscompetitions,Business,Branches,Contributingfields")] RoboticsCompetitionsInRelation roboticsCompetitionsInRelation) { if (id != roboticsCompetitionsInRelation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roboticsCompetitionsInRelation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoboticsCompetitionsInRelationExists(roboticsCompetitionsInRelation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["Contributingfields"] = new SelectList(_context.ContributingFields, "Id", "Id", roboticsCompetitionsInRelation.Contributingfields); ViewData["Business"] = new SelectList(_context.Business, "Id", "Id", roboticsCompetitionsInRelation.Business); ViewData["Branches"] = new SelectList(_context.Branches, "Id", "Id", roboticsCompetitionsInRelation.Branches); ViewData["Roboticscompetitions"] = new SelectList(_context.RoboticsCompetitions, "Id", "Id", roboticsCompetitionsInRelation.Roboticscompetitions); return(View(roboticsCompetitionsInRelation)); }
public async Task <IActionResult> Create([Bind("Id,Roboticscompetitions,Business,Branches,Contributingfields")] RoboticsCompetitionsInRelation roboticsCompetitionsInRelation) { if (ModelState.IsValid) { _context.Add(roboticsCompetitionsInRelation); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["Contributingfields"] = new SelectList(_context.ContributingFields, "Id", "Id", roboticsCompetitionsInRelation.Contributingfields); ViewData["Business"] = new SelectList(_context.Business, "Id", "Id", roboticsCompetitionsInRelation.Business); ViewData["Branches"] = new SelectList(_context.Branches, "Id", "Id", roboticsCompetitionsInRelation.Branches); ViewData["Roboticscompetitions"] = new SelectList(_context.RoboticsCompetitions, "Id", "Id", roboticsCompetitionsInRelation.Roboticscompetitions); return(View(roboticsCompetitionsInRelation)); }