示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Roboticsprinciples,Language")] RoboticsPrinciplesTrans roboticsPrinciplesTrans)
        {
            if (id != roboticsPrinciplesTrans.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(roboticsPrinciplesTrans);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoboticsPrinciplesTransExists(roboticsPrinciplesTrans.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["Language"]           = new SelectList(_context.Languages, "Id", "Code", roboticsPrinciplesTrans.Language);
            ViewData["Roboticsprinciples"] = new SelectList(_context.RoboticsPrinciples, "Id", "Id", roboticsPrinciplesTrans.Roboticsprinciples);
            return(View(roboticsPrinciplesTrans));
        }
示例#2
0
        public async Task <IActionResult> Create(int RoboticsPrinciples, [Bind("Id,Name,Description,Roboticsprinciples,Language")] RoboticsPrinciplesTrans roboticsPrinciplesTrans)
        {
            if (ModelState.IsValid)
            {
                if (RoboticsPrinciples == 0)
                {
                    RoboticsPrinciples entry = new RoboticsPrinciples(); _context.Add(entry); roboticsPrinciplesTrans.Roboticsprinciples = entry.Id;
                }

                _context.Add(roboticsPrinciplesTrans);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["Language"]           = new SelectList(_context.Languages, "Id", "Code", roboticsPrinciplesTrans.Language);
            ViewData["Roboticsprinciples"] = new SelectList(_context.RoboticsPrinciples, "Id", "Id", roboticsPrinciplesTrans.Roboticsprinciples);
            return(View(roboticsPrinciplesTrans));
        }