public async Task <HttpResponseMessage> GetDataList(int goodsCategoryTypeId, bool?isActive = null, int?iGoalTypeId = null) { GoalGoodsCategoryTypeEnum catTypeId = default(GoalGoodsCategoryTypeEnum); GoalTypeEnum goalTypeId = default(GoalTypeEnum); if (goodsCategoryTypeId != 0) { catTypeId = Utilities.ToEnum <GoalGoodsCategoryTypeEnum>(goodsCategoryTypeId).Value; } if (iGoalTypeId.HasValue) { goalTypeId = Utilities.ToEnum <GoalTypeEnum>(iGoalTypeId).Value; } IBusinessResultValue <List <GoalGoodsCategory> > entities = await businessService.LoadVisibleGoalGoodsCategoryListAsync( where : x => (x.GoalGoodsCategoryTypeId == catTypeId || goodsCategoryTypeId == 0) && (x.GoalTypeId == goalTypeId || iGoalTypeId.HasValue == false) && (x.IsActive == isActive || isActive.HasValue == false)); if (entities.ReturnStatus == false) { CreateErrorResponse(entities); } var mapper = GetMapper(); var dataSource = mapper.Map <List <GoalGoodsCategoryViewModel> >(entities.ResultValue); return(CreateSuccessedListResponse(dataSource)); }
public async Task <HttpResponseMessage> GetListforReport(int goodsCategoryTypeId, int iGoalTypeId , string startDate , string endDate) { GoalGoodsCategoryTypeEnum catTypeId = Utilities.ToEnum <GoalGoodsCategoryTypeEnum>(goodsCategoryTypeId).Value; GoalTypeEnum goalTypeId = Utilities.ToEnum <GoalTypeEnum>(iGoalTypeId).Value; IBusinessResultValue <List <GoalGoodsCategory> > entities = await businessService.LoadGoalGoodsCategoryForReportAsync(catTypeId , goalTypeId , Utilities.ToDateTime(startDate).Value , Utilities.ToDateTime(endDate).Value ); if (entities.ReturnStatus == false) { CreateErrorResponse(entities); } var mapper = GetMapper(); var dataSource = mapper.Map <List <GoalGoodsCategoryViewModel> >(entities.ResultValue); return(CreateSuccessedListResponse(dataSource)); }
public async Task <IBusinessResultValue <List <GoalGoodsCategory> > > LoadGoalGoodsCategoryForReportAsync(GoalGoodsCategoryTypeEnum goodsCategoryTypeId, GoalTypeEnum goalTypeId, DateTime startDate, DateTime endDate) { var result = new BusinessResultValue <List <GoalGoodsCategory> >(); try { result.ResultValue = await(from goal in unitOfWork.GoalDataService.GetQuery() join ggc in unitOfWork.GoalGoodsCategoryDataService.GetQuery() on goal.GoalGoodsCategoryId equals ggc.Id where goal.StartDate >= startDate && goal.EndDate <= endDate && goal.GoalGoodsCategoryTypeId == goodsCategoryTypeId && goal.GoalTypeId == goalTypeId select ggc).ToListAsync(); } catch (Exception ex) { CatchException(ex, result, ""); } return(result); }