public IResult <IQueryable <IMillAndWetdownSummaryReturn> > GetMillAndWetdownSummaries() { var select = ChileLotProductionProjectors.SelectSummary(); var query = _productionUnitOfWork.ChileLotProductionRepository.All().Where(l => l.ProductionType == ProductionType.MillAndWetdown).AsExpandable().Select(select); return(new SuccessResult <IQueryable <IMillAndWetdownSummaryReturn> >(query)); }
public IResult <IMillAndWetdownDetailReturn> GetMillAndWetdownDetail(string lotKey) { if (lotKey == null) { throw new ArgumentNullException("lotKey"); } var keyResult = KeyParserHelper.ParseResult <ILotKey>(lotKey); if (!keyResult.Success) { return(keyResult.ConvertTo <IMillAndWetdownDetailReturn>()); } var predicate = new LotKey(keyResult.ResultingObject).GetPredicate <ChileLotProduction>().And(c => c.ProductionType == ProductionType.MillAndWetdown); var select = ChileLotProductionProjectors.SelectDetail(_productionUnitOfWork); var entry = _productionUnitOfWork.ChileLotProductionRepository.Filter(predicate).AsExpandable().Select(select).FirstOrDefault(); if (entry == null) { return(new InvalidResult <IMillAndWetdownDetailReturn>(null, string.Format(UserMessages.MillAndWetdownEntryNotFound, lotKey))); } return(new SuccessResult <IMillAndWetdownDetailReturn>(entry)); }