コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id")] RobotComponentsAndDesignFeatures robotComponentsAndDesignFeatures)
        {
            if (id != robotComponentsAndDesignFeatures.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(robotComponentsAndDesignFeatures);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RobotComponentsAndDesignFeaturesExists(robotComponentsAndDesignFeatures.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(robotComponentsAndDesignFeatures));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id")] RobotComponentsAndDesignFeatures robotComponentsAndDesignFeatures)
        {
            if (ModelState.IsValid)
            {
                _context.Add(robotComponentsAndDesignFeatures);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(robotComponentsAndDesignFeatures));
        }
コード例 #3
0
        public async Task <IActionResult> Create(int RobotComponentsAndDesignFeatures, [Bind("Id,Name,Description,Robotcomponentsanddesignfeatures,Language")] RobotComponentsAndDesignFeaturesTrans robotComponentsAndDesignFeaturesTrans)
        {
            if (ModelState.IsValid)
            {
                if (RobotComponentsAndDesignFeatures == 0)
                {
                    RobotComponentsAndDesignFeatures entry = new RobotComponentsAndDesignFeatures(); _context.Add(entry); robotComponentsAndDesignFeaturesTrans.Robotcomponentsanddesignfeatures = entry.Id;
                }

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

                return(RedirectToAction("Index"));
            }
            ViewData["Language"] = new SelectList(_context.Languages, "Id", "Code", robotComponentsAndDesignFeaturesTrans.Language);
            ViewData["Robotcomponentsanddesignfeatures"] = new SelectList(_context.RobotComponentsAndDesignFeatures, "Id", "Id", robotComponentsAndDesignFeaturesTrans.Robotcomponentsanddesignfeatures);
            return(View(robotComponentsAndDesignFeaturesTrans));
        }