public object FindByID(string entityID) { GetYesNoStepDataResponse response = null; using (YesNoStepMongoContext ctx = new YesNoStepMongoContext(_dbName)) { List <IMongoQuery> queries = new List <IMongoQuery>(); queries.Add(Query.EQ(MEYesNo.IdProperty, ObjectId.Parse(entityID))); queries.Add(Query.EQ(MEYesNo.DeleteFlagProperty, false)); IMongoQuery mQuery = Query.And(queries); MEYesNo meYesNo = ctx.YesNoSteps.Collection.Find(mQuery).FirstOrDefault(); if (meYesNo != null) { response = new GetYesNoStepDataResponse(); API.DataDomain.Step.DTO.YesNoData yesnoStep = new API.DataDomain.Step.DTO.YesNoData { ID = meYesNo.Id.ToString(), Type = meYesNo.Type.ToString(), Status = Helper.ToFriendlyString(meYesNo.Status), Question = meYesNo.Question, Notes = meYesNo.Notes }; response.YesNoStep = yesnoStep; } } return(response); }
public IEnumerable <object> SelectAll() { GetAllYesNoStepDataResponse response = new GetAllYesNoStepDataResponse(); List <DTO.YesNoData> list = new List <DTO.YesNoData>(); using (YesNoStepMongoContext ctx = new YesNoStepMongoContext(_dbName)) { //var steps = (from a in ctx.YesNoSteps // where a.Id == new ObjectId("531a2d05c3478604270000f8") // select new DTO.YesNoData // { // ID = a.Id.ToString(), // //Question = a.Question // }).First(); var step = from a in ctx.YesNoSteps where a.Id.Equals(new ObjectId("531a2d05c3478604270000f8")) select a; //var x = from a in ctx.YesNoSteps // select a; //response.Steps = steps; } return(response.Steps); }