コード例 #1
0
        // GET: DepartmentProperties/Create
        public IActionResult Create(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var department = _context.Departments
                             .Include(o => o.Properties)
                             .SingleOrDefaultAsync(m => m.DepartmentId == id);

            var property = new DepartmentProperty()
            {
                OwnerDepartment = department.Result
            };

            department.Result.Properties.Add(property);
            _context.Attach(property);
            return(View(property));
        }
コード例 #2
0
        // GET: ProjectProperties/Create
        public IActionResult Create(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var project = _context.Projects
                          .Include(p => p.Properties)
                          .SingleOrDefaultAsync(m => m.ProjectId == id);

            var property = new ProjectProperty()
            {
                OwnerProject = project.Result
            };

            project.Result.Properties.Add(property);
            _context.Attach(property);
            return(View(property));
        }
コード例 #3
0
        // GET: OrganizationProperties/Create
        public IActionResult Create(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var organization = _context.Organizations
                               .Include(o => o.Properties)
                               .SingleOrDefaultAsync(m => m.OrganizationId == id);

            var property = new OrganizationProperty()
            {
                OwnerOrganization = organization.Result
            };

            organization.Result.Properties.Add(property);
            _context.Attach(property);
            return(View(property));
        }