コード例 #1
0
        public Application Create(Application application)
        {
            var createdApplication = _context.Add(application);

            _context.SaveChanges();

            return(createdApplication.Entity);
        }
コード例 #2
0
        public IActionResult CreateType(SoftwareTypeViewModel vm)
        {
            SoftwareType model = new SoftwareType()
            {
                Description = vm.Description,
                Name        = vm.Name,
            };

            _db.SoftwareTypes.Add(model);
            _db.SaveChanges();
            int counter = 0;
            List <SoftwareTypeOptions> softwareTypeOptions = new List <SoftwareTypeOptions>();

            foreach (var option in vm.hiddenID)
            {
                SoftwareTypeOptions softwareTypeOption = new SoftwareTypeOptions()
                {
                    SoftwareOptionID = Convert.ToInt32(option),
                    SoftwareTypeID   = model.ID,
                    Value            = vm.Values[counter].ToString(),
                };

                _db.Add(softwareTypeOption);
                counter++;
            }
            _db.SaveChanges();


            return(RedirectToAction("Index", "Attribute"));


            //_db.Attribute.Add(attribute);
            //_db.SaveChanges();
            //return RedirectToAction("Index");
            //return View("Index");
        }