Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id")] SpecificRobots specificRobots)
        {
            if (id != specificRobots.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(specificRobots);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpecificRobotsExists(specificRobots.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(specificRobots));
        }
        public async Task <IActionResult> Create(int SpecificRobots, [Bind("Id,Name,Description,Specificrobots,Language")] SpecificRobotsTrans specificRobotsTrans)
        {
            if (ModelState.IsValid)
            {
                if (SpecificRobots == 0)
                {
                    SpecificRobots entry = new SpecificRobots(); _context.Add(entry); specificRobotsTrans.Specificrobots = entry.Id;
                }

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

                return(RedirectToAction("Index"));
            }
            ViewData["Language"]       = new SelectList(_context.Languages, "Id", "Code", specificRobotsTrans.Language);
            ViewData["Specificrobots"] = new SelectList(_context.SpecificRobots, "Id", "Id", specificRobotsTrans.Specificrobots);
            return(View(specificRobotsTrans));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("Id")] SpecificRobots specificRobots)
        {
            int id = new int();

            if (ModelState.IsValid)
            {
                _context.Add(specificRobots);
                await _context.SaveChangesAsync();

                List <SpecificRobots> allspecificrobots = new List <SpecificRobots>();
                allspecificrobots = await _context.SpecificRobots.ToListAsync();

                foreach (SpecificRobots item in allspecificrobots)
                {
                    if (item == specificRobots)
                    {
                        id = specificRobots.Id;
                    }
                }
                return(RedirectToAction("Create", "SpecificRobotsTrans", new { specificrobots = id }));
            }

            return(View());
        }