Пример #1
0
        public GetAllModulesResponse SelectAll(double versionNumber, Status status)
        {
            GetAllModulesResponse response = new GetAllModulesResponse()
            {
                Version = versionNumber
            };

            List <DTO.Module> list = new List <DTO.Module>();

            using (ModuleMongoContext ctx = new ModuleMongoContext(_dbName))
            {
                list = (from m in ctx.Modules
                        select new DTO.Module
                {
                    Id = m.Id.ToString(),
                    Name = m.Name,
                    Description = m.Description,
                    Status = m.Status.ToString(),
                    Version = m.Version
                }).ToList();
            }
            response.Modules = list;

            return(response);
        }
Пример #2
0
 public object FindByID(string entityID)
 {
     DTO.Module module = null;
     using (ModuleMongoContext ctx = new ModuleMongoContext(_dbName))
     {
         module = (from m in ctx.Modules
                   where m.Id == ObjectId.Parse(entityID)
                   select new DTO.Module
         {
             Id = m.Id.ToString(),
             Name = m.Name,
             Description = m.Description,
             Objectives = m.Objectives.Select(i => i.ID).ToList(),
             Status = m.Status.ToString(),
             Version = m.Version
         }).FirstOrDefault();
     }
     return(module);
 }