Beispiel #1
0
        public async Task <IActionResult> ProjectAddNew(int id, Project project)
        {
            project = await _context.Projects.FindAsync(id);

            if (project == null)
            {
                return(NotFound());
            }

            var projP   = _sorter.MembersClientsNotInProject(_context, project);
            var memSort = projP.Members;
            var cliSort = projP.Clients;

            List <SelectListItem> memberList = new List <SelectListItem>();
            List <SelectListItem> clientList = new List <SelectListItem>();

            foreach (var m in memSort)
            {
                memberList.Add(new SelectListItem {
                    Value = m.ID.ToString(), Text = m.ToString()
                });
            }

            foreach (var c in cliSort)
            {
                clientList.Add(new SelectListItem {
                    Value = c.ID.ToString(), Text = c.ToString()
                });
            }

            var projDetails = new ProjectAddViewModel()
            {
                PAVID      = id,
                NewProject = project,
                MemberList = memberList,
                ClientList = clientList
            };

            return(View(projDetails));
        }