public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Roboticsorganizations,Language")] RoboticsOrganizationsTrans roboticsOrganizationsTrans) { if (id != roboticsOrganizationsTrans.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roboticsOrganizationsTrans); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoboticsOrganizationsTransExists(roboticsOrganizationsTrans.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["Language"] = new SelectList(_context.Languages, "Id", "Code", roboticsOrganizationsTrans.Language); ViewData["Roboticsorganizations"] = new SelectList(_context.RoboticsOrganizations, "Id", "Id", roboticsOrganizationsTrans.Roboticsorganizations); return(View(roboticsOrganizationsTrans)); }
public async Task <IActionResult> Create(int RoboticsOrganizations, [Bind("Id,Name,Description,Roboticsorganizations,Language")] RoboticsOrganizationsTrans roboticsOrganizationsTrans) { if (ModelState.IsValid) { if (RoboticsOrganizations == 0) { RoboticsOrganizations entry = new RoboticsOrganizations(); _context.Add(entry); roboticsOrganizationsTrans.Roboticsorganizations = entry.Id; } _context.Add(roboticsOrganizationsTrans); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["Language"] = new SelectList(_context.Languages, "Id", "Code", roboticsOrganizationsTrans.Language); ViewData["Roboticsorganizations"] = new SelectList(_context.RoboticsOrganizations, "Id", "Id", roboticsOrganizationsTrans.Roboticsorganizations); return(View(roboticsOrganizationsTrans)); }