public FindIngredientGroupsResponse Find(FindIngredientGroupsRequest request) { try { _ingredientGroupQuery.WithOnlyActivated(true); _ingredientGroupQuery.WithOnlyStatusActivated(request.OnlyStatusActivated); _ingredientGroupQuery.WithOnlyStatusDeactivated(request.OnlyStatusDeactivated); _ingredientGroupQuery.WithName(request.Name); _ingredientGroupQuery.Sort(request.Sort, request.SortBy); var totalRecords = _ingredientGroupQuery.TotalRecords(); _ingredientGroupQuery.Paginate(request.StartPage, request.EndPage); var ingredientGroups = _ingredientGroupQuery.Execute(); return(new FindIngredientGroupsResponse { IngredientGroups = TypeAdapter.Adapt <List <IngredientGroupResponse> >(ingredientGroups), TotalRecords = totalRecords }); } catch (DataAccessException) { throw new ApplicationException(); } }
public FindIngredientGroupsResponse Get(FindIngredientGroupsRequest request) { return(_ingredientGroupService.Find(request)); }