public IHttpActionResult CheckReference(Guid orgId, String refId)
        {
            var result = new ReferenceCheck();

            List <ClientName> clients = repo_.SearchByRefId(refId).ToList();

            if (clients.Count == 0)
            {
                return(Ok(result));
            }

            List <Project> projects = poRepo_.FetchProjects(orgId).ToList();

            bool externalOrg = false;

            foreach (ClientName cn in clients)
            {
                Project p = projects.Find(pp => pp.Id == cn.ProjectId);
                if (p == null)
                {
                    externalOrg = true;
                    continue;
                } // if ...

                if (!cn.Discharged.HasValue)
                {
                    result.Projects.Add(new RegisteredData(p, cn));
                }
                else
                {
                    result.Discharged.Add(new RegisteredData(p, cn));
                }
            } // foreach

            if (externalOrg)
            {
                result.External = true;
            }

            return(Ok(result));
        } // CheckReference
示例#2
0
 protected override IList <Project> listProjects(ProjectOrganisation org)
 {
     return(repo_.FetchProjects(org.Id));
 }
 public IEnumerable<Project> OrganisationProjects(Guid id) {
   return repo_.FetchProjects(id);
 } // OrganisationProjects