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); }
public GetAllModulesResponse Get(GetAllModulesRequest request) { GetAllModulesResponse response = new GetAllModulesResponse(); try { //Get the UserId from the Header and update the request object //request.UserId = HttpContext.Current.Request.Headers.Get(_phytelUserIDToken); if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("ModuleDD:Get()::Unauthorized Access"); } response = ModuleDataManager.GetModuleList(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Common.Helper.LogException(int.Parse(aseProcessID), ex); } return(response); }
public static GetAllModulesResponse GetModuleList(GetAllModulesRequest request) { GetAllModulesResponse result = new GetAllModulesResponse(); MongoModuleRepository <GetAllModulesResponse> repo = new MongoModuleRepository <GetAllModulesResponse>(request.ContractNumber); repo.UserId = request.UserId; result = repo.SelectAll(request.Version, Status.Active); return(result); }