示例#1
0
 public CreateRestaurantModel(ICategoryData categoryData, IRestaurantData restaurantData)
 {
     _categoryData   = categoryData;
     _restaurantData = restaurantData;
 }
示例#2
0
 public CategoryProcess(IUnitOfWork unitOfWork, ICategoryData categoryData, IMapper mapper)
 {
     _unitOfWork = unitOfWork;
     _mapper     = mapper;
     _unitOfWork.CategoryData = categoryData;
 }
示例#3
0
 public DetailModel(IRecipeData recipeData, ICategoryData categoryData)
 {
     this.recipeData   = recipeData;
     this.categoryData = categoryData;
 }
 public CategoriesController(ICategoryData categoryData)
 {
     this.categoryData = categoryData;
 }
示例#5
0
 public CategoryBiz(ICategoryData actionCategory)
 {
     _actionCategory = actionCategory;
 }
示例#6
0
        public RootQuery(IEmployeeData _employeeData,
                         IRoleData _roleData,
                         IPermissionData _permissionData,
                         ITaskData _taskData,
                         ICategoryData _categoryData,
                         IStockData _stockData,
                         IStepData _stepData,
                         IWineData _wineData,
                         IProductData _productData)
        {
//EMPLOYEES
            Field <ListGraphType <EmployeeType> >("employees", resolve: context =>
            {
                return(_employeeData.GetAllAsync());
            });

            Field <EmployeeType>("employee",
                                 arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                                 resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_employeeData.GetAsync(id));
            });

            Field <EmployeeType>("employeeEmail",
                                 arguments: new QueryArguments
            {
                new QueryArgument <StringGraphType> {
                    Name = "email"
                },
                new QueryArgument <StringGraphType> {
                    Name = "password"
                }
            },
                                 resolve: context =>
            {
                string email    = context.GetArgument <string>("email");
                string password = context.GetArgument <string>("password");
                return(_employeeData.GetByEmailPasswordAsync(email, password));
            });


//ROLES
            Field <ListGraphType <RoleType> >("roles", resolve: context =>
            {
                return(_roleData.GetAllAsync());
            });

            Field <RoleType>("role",
                             arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                             resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_roleData.GetAsync(id));
            });

//PERMISSIONS
            Field <ListGraphType <PermissionType> >("permissions", resolve: context =>
            {
                return(_permissionData.GetAllAsync());
            });

            Field <PermissionType>("permission",
                                   arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                                   resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_permissionData.GetAsync(id));
            });

// TASKS
            Field <ListGraphType <TaskType> >("tasks", resolve: context =>
            {
                return(_taskData.GetAllAsync());
            });

            Field <TaskType>("task",
                             arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                             resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_taskData.GetAsync(id));
            });

// CATEGORIES
            Field <ListGraphType <CategoryType> >("categories", resolve: context =>
            {
                return(_categoryData.GetAllAsync());
            });

            Field <CategoryType>("category",
                                 arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                                 resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_categoryData.GetAsync(id));
            });

// STOCKS
            Field <ListGraphType <StockType> >("stocks", resolve: context =>
            {
                return(_stockData.GetAllAsync());
            });

            Field <StockType>("stock",
                              arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                              resolve: context =>
            {
                // try{
                int id = context.GetArgument <int>("id");
                Console.WriteLine("entrou");
                return(_stockData.GetAsync(id));
                // } catch (Exception error) {
                // Console.WriteLine(error);
                // return null;
                // }
            });

// STEPS
            Field <ListGraphType <StepType> >("steps", resolve: context =>
            {
                return(_stepData.GetAllAsync());
            });

            Field <StepType>("step",
                             arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                             resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_stepData.GetAsync(id));
            });

// WINES
            Field <ListGraphType <WineType> >("wines", resolve: context =>
            {
                return(_wineData.GetAllAsync());
            });

            Field <WineType>("wine",
                             arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                             resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_wineData.GetAsync(id));
            });

// PRODUCTS
            Field <ListGraphType <ProductType> >("products", resolve: context =>
            {
                return(_productData.GetAllAsync());
            });

            Field <ProductType>("product",
                                arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "id"
                }
            },
                                resolve: context =>
            {
                int id = context.GetArgument <int>("id");
                return(_productData.GetAsync(id));
            });
        }
 public ListModel(ICategoryData categoryData)
 {
     this.categoryData = categoryData;
 }
示例#8
0
 public DeleteModel(IProductData productData, ICategoryData categoryData)
 {
     this.productData  = productData;
     this.categoryData = categoryData;
 }
示例#9
0
 public AddEditModel(IProductData productData, ICategoryData categoryData)
 {
     this.productData  = productData;
     this.categoryData = categoryData;
 }
 public CategoriesController(ICategoryData categoriesRepository)
 {
     _categoriesRepository = categoriesRepository;
 }
 public DetailModel(ICategoryData categoryData)
 {
     this.categoryData = categoryData;
 }
示例#12
0
 public DeleteModel(ICategoryData categoryData, IRecipeData recipeData)
 {
     this.categoryData = categoryData;
     this.recipeData   = recipeData;
 }
示例#13
0
 public RestaurantsController(ICategoryData categoryData, IRestaurantData restaurantData)
 {
     _categoryData   = categoryData;
     _restaurantData = restaurantData;
 }
示例#14
0
 public EditModel(IShoppingData shoppingData, ICategoryData categoryData)
 {
     this.shopingData = shoppingData;
     this.Categories  = categoryData.CategoryList();
 }
示例#15
0
 public SearchModel(IProductData productData, ICategoryData categoryData)
 {
     this.productData  = productData;
     this.categoryData = categoryData;
 }
示例#16
0
        private readonly ISchemaData metadataSchema = null; //not implemented by DD4T at this time

        #endregion Fields

        #region Constructors

        public Keyword(IKeyword keyword, string categoryName = null)
        {
            this.keyword = keyword;
            if (keyword != null)
            {
                this.metadata = new FieldSet(keyword.MetadataFields);
                //DD4T provides no way to retrieve an ICategory object
                this.category = new CategoryData(keyword.TaxonomyId, categoryName);
            }
        }
示例#17
0
 public ListModel(IShoppingData shoppingData, ICategoryData categoryList)
 {
     storeData    = shoppingData;
     categoryData = categoryList;
     Categories   = categoryData.CategoryList();
 }
示例#18
0
 public CategoryController(ICategoryData categoryData)
 {
     _categoryData = categoryData;
 }
示例#19
0
        // public RootMutation(IWineData wineData)
        // {
        //    Field<WineType>(
        //       "addWine",
        //       arguments: new QueryArguments
        //       {
        //          new QueryArgument<InputWineType>(){ Name = "wine"}
        //       },
        //       resolve: context =>
        //       {
        //          var wine = context.GetArgument<Wine>("wine");
        //          wineData.AddWine(wine);
        //          return null;
        //       }
        //    );
        // }

        public RootMutation(IEmployeeData employeeData,
                            IRoleData roleData,
                            IPermissionData permissionData,
                            ITaskData taskData,
                            ICategoryData categoryData,
                            IStockData stockData,
                            IStepData stepData,
                            IWineData wineData,
                            IProductData productData,
                            IStockProductData stockProductData,
                            IStockWineData stockWineData)
        {
// EMPLOYEE
            Field <EmployeeType>(
                "addEmployee",
                arguments: new QueryArguments
            {
                new QueryArgument <InputEmployeeType>()
                {
                    Name = "employee"
                }
            },
                resolve: context =>
            {
                var employee = context.GetArgument <Employee>("employee");
                return(employeeData.AddEmployee(employee));
            }
                );

            Field <EmployeeType>(
                "updateEmployee",
                arguments: new QueryArguments {
                new QueryArgument <InputEmployeeType>()
                {
                    Name = "employee"
                }
            },
                resolve: context =>
            {
                var employee = context.GetArgument <Employee>("employee");
                return(employeeData.Update(employee));
            }
                );

            Field <EmployeeType>(
                "deleteEmployee",
                arguments: new QueryArguments {
                new QueryArgument <InputEmployeeType>()
                {
                    Name = "employee"
                }
            },
                resolve: context =>
            {
                var employee = context.GetArgument <Employee>("employee");
                employeeData.Delete(employee);
                return(employee);
            }
                );


// ROLE
            Field <RoleType>(
                "addRole",
                arguments: new QueryArguments
            {
                new QueryArgument <InputRoleType>()
                {
                    Name = "role"
                }
            },
                resolve: context =>
            {
                var role = context.GetArgument <Role>("role");
                return(roleData.AddRole(role));
            }
                );

            Field <RoleType>(
                "updateRole",
                arguments: new QueryArguments {
                new QueryArgument <InputRoleType>()
                {
                    Name = "role"
                }
            },
                resolve: context =>
            {
                var role = context.GetArgument <Role>("role");
                return(roleData.Update(role));
            }
                );

            Field <RoleType>(
                "deleteRole",
                arguments: new QueryArguments {
                new QueryArgument <InputRoleType>()
                {
                    Name = "role"
                }
            },
                resolve: context =>
            {
                var role = context.GetArgument <Role>("role");
                roleData.Delete(role);
                return(role);
            }
                );

// PERMISSION
            Field <PermissionType>(
                "addPermission",
                arguments: new QueryArguments
            {
                new QueryArgument <InputPermissionType>()
                {
                    Name = "permission"
                }
            },
                resolve: context =>
            {
                var permission = context.GetArgument <Permission>("permission");
                return(permissionData.AddPermission(permission));
            }
                );

            Field <PermissionType>(
                "updatePermission",
                arguments: new QueryArguments {
                new QueryArgument <InputPermissionType>()
                {
                    Name = "permission"
                }
            },
                resolve: context =>
            {
                var permission = context.GetArgument <Permission>("permission");
                return(permissionData.Update(permission));
            }
                );

            Field <PermissionType>(
                "deletePermission",
                arguments: new QueryArguments {
                new QueryArgument <InputPermissionType>()
                {
                    Name = "permission"
                }
            },
                resolve: context =>
            {
                var permission = context.GetArgument <Permission>("permission");
                permissionData.Delete(permission);
                return(permission);
            }
                );


// TASK
            Field <TaskType>(
                "addTask",
                arguments: new QueryArguments
            {
                new QueryArgument <InputTaskType>()
                {
                    Name = "task"
                }
            },
                resolve: context =>
            {
                var task = context.GetArgument <Task>("task");
                return(taskData.AddTask(task));
            }
                );

            Field <TaskType>(
                "updateTask",
                arguments: new QueryArguments {
                new QueryArgument <InputTaskType>()
                {
                    Name = "task"
                }
            },
                resolve: context =>
            {
                var task = context.GetArgument <Task>("task");
                return(taskData.Update(task));
            }
                );

            Field <TaskType>(
                "deleteTask",
                arguments: new QueryArguments {
                new QueryArgument <InputTaskType>()
                {
                    Name = "task"
                }
            },
                resolve: context =>
            {
                var task = context.GetArgument <Task>("task");
                taskData.Delete(task);
                return(task);
            }
                );


// CATEGORY
            Field <CategoryType>(
                "addCategory",
                arguments: new QueryArguments
            {
                new QueryArgument <InputCategoryType>()
                {
                    Name = "category"
                }
            },
                resolve: context =>
            {
                var category = context.GetArgument <Category>("category");
                return(categoryData.AddCategory(category));
            }
                );

            Field <CategoryType>(
                "updateCategory",
                arguments: new QueryArguments {
                new QueryArgument <InputCategoryType>()
                {
                    Name = "category"
                }
            },
                resolve: context =>
            {
                var category = context.GetArgument <Category>("category");
                return(categoryData.Update(category));
            }
                );

            Field <CategoryType>(
                "deleteCategory",
                arguments: new QueryArguments {
                new QueryArgument <InputCategoryType>()
                {
                    Name = "category"
                }
            },
                resolve: context =>
            {
                var category = context.GetArgument <Category>("category");
                categoryData.Delete(category);
                return(category);
            }
                );

// STOCK
            Field <StockType>(
                "addStock",
                arguments: new QueryArguments
            {
                new QueryArgument <InputStockType>()
                {
                    Name = "stock"
                }
            },
                resolve: context =>
            {
                var stock = context.GetArgument <Stock>("stock");
                return(stockData.AddStock(stock));
            }
                );

            Field <StockType>(
                "updateStock",
                arguments: new QueryArguments {
                new QueryArgument <InputStockType>()
                {
                    Name = "stock"
                }
            },
                resolve: context =>
            {
                var stock = context.GetArgument <Stock>("stock");
                return(stockData.Update(stock));
            }
                );

            Field <StockType>(
                "deleteStock",
                arguments: new QueryArguments {
                new QueryArgument <InputStockType>()
                {
                    Name = "stock"
                }
            },
                resolve: context =>
            {
                var stock = context.GetArgument <Stock>("stock");
                stockData.Delete(stock);
                return(stock);
            }
                );

// STEP
            Field <StepType>(
                "addStep",
                arguments: new QueryArguments
            {
                new QueryArgument <InputStepType>()
                {
                    Name = "step"
                }
            },
                resolve: context =>
            {
                var step = context.GetArgument <Step>("step");
                return(stepData.AddStep(step));
            }
                );

            Field <StepType>(
                "updateStep",
                arguments: new QueryArguments {
                new QueryArgument <InputStepType>()
                {
                    Name = "step"
                }
            },
                resolve: context =>
            {
                var step = context.GetArgument <Step>("step");
                return(stepData.Update(step));
            }
                );

            Field <StepType>(
                "deleteStep",
                arguments: new QueryArguments {
                new QueryArgument <InputStepType>()
                {
                    Name = "step"
                }
            },
                resolve: context =>
            {
                var step = context.GetArgument <Step>("step");
                stepData.Delete(step);
                return(step);
            }
                );

// WINE

            Field <WineType>(
                "addWine",
                arguments: new QueryArguments
            {
                new QueryArgument <InputWineType>()
                {
                    Name = "wine"
                }
            },
                resolve: context =>
            {
                var wine = context.GetArgument <Wine>("wine");
                return(wineData.AddWine(wine));
            }
                );

            Field <WineType>(
                "updateWine",
                arguments: new QueryArguments {
                new QueryArgument <InputWineType>()
                {
                    Name = "wine"
                }
            },
                resolve: context =>
            {
                var wine = context.GetArgument <Wine>("wine");
                return(wineData.Update(wine));
            }
                );

            Field <WineType>(
                "deleteWine",
                arguments: new QueryArguments {
                new QueryArgument <InputWineType>()
                {
                    Name = "wine"
                }
            },
                resolve: context =>
            {
                var wine = context.GetArgument <Wine>("wine");
                wineData.Delete(wine);
                return(wine);
            }
                );

// PRODUCT
            Field <ProductType>(
                "addProduct",
                arguments: new QueryArguments
            {
                new QueryArgument <InputProductType>()
                {
                    Name = "product"
                }
            },
                resolve: context =>
            {
                var product = context.GetArgument <Product>("product");
                return(productData.AddProduct(product));
            }
                );

            Field <ProductType>(
                "updateProduct",
                arguments: new QueryArguments {
                new QueryArgument <InputProductType>()
                {
                    Name = "product"
                }
            },
                resolve: context =>
            {
                var product = context.GetArgument <Product>("product");
                return(productData.Update(product));
            }
                );

            Field <ProductType>(
                "deleteProduct",
                arguments: new QueryArguments {
                new QueryArgument <InputProductType>()
                {
                    Name = "product"
                }
            },
                resolve: context =>
            {
                var product = context.GetArgument <Product>("product");
                productData.Delete(product);
                return(product);
            }
                );

// StockProduct
            Field <StockProductType>(
                "addStockProduct",
                arguments: new QueryArguments
            {
                new QueryArgument <InputStockProductType>()
                {
                    Name = "stockProduct"
                }
            },
                resolve: context =>
            {
                var stockProduct = context.GetArgument <StockProduct>("stockProduct");
                return(stockProductData.AddStockProduct(stockProduct));
            }
                );

            Field <StockProductType>(
                "updateStockProduct",
                arguments: new QueryArguments {
                new QueryArgument <InputStockProductType>()
                {
                    Name = "stockProduct"
                }
            },
                resolve: context =>
            {
                var stockProduct = context.GetArgument <StockProduct>("stockProduct");
                return(stockProductData.Update(stockProduct));
            }
                );

            Field <StockProductType>(
                "deleteStockProduct",
                arguments: new QueryArguments {
                new QueryArgument <InputStockProductType>()
                {
                    Name = "stockProduct"
                }
            },
                resolve: context =>
            {
                var stockProduct = context.GetArgument <StockProduct>("stockProduct");
                stockProductData.Delete(stockProduct);
                return(stockProduct);
            }
                );

// StockWine
            Field <StockWineType>(
                "addStockWine",
                arguments: new QueryArguments
            {
                new QueryArgument <InputStockWineType>()
                {
                    Name = "stockWine"
                }
            },
                resolve: context =>
            {
                var stockWine = context.GetArgument <StockWine>("stockWine");
                return(stockWineData.AddStockWine(stockWine));
            }
                );

            Field <StockWineType>(
                "updateStockWine",
                arguments: new QueryArguments {
                new QueryArgument <InputStockWineType>()
                {
                    Name = "stockWine"
                }
            },
                resolve: context =>
            {
                var stockWine = context.GetArgument <StockWine>("stockWine");
                return(stockWineData.Update(stockWine));
            }
                );

            Field <StockWineType>(
                "deleteStockWine",
                arguments: new QueryArguments {
                new QueryArgument <InputStockWineType>()
                {
                    Name = "stockWine"
                }
            },
                resolve: context =>
            {
                var stockWine = context.GetArgument <StockWine>("stockWine");
                stockWineData.Delete(stockWine);
                return(stockWine);
            }
                );
        }
示例#20
0
 public CategoryMenu(ICategoryData category)
 {
     this._category = category;
 }
 public StoreCategoryController(ICategoryData storeCategoryRepository)
 {
     _storeCategoryRepository = storeCategoryRepository;
 }
示例#22
0
 public PieController(IPieData pieData, ICategoryData categoryData)
 {
     this._pieData      = pieData;
     this._categoryData = categoryData;
 }
示例#23
0
 public SearchModel(IRecipeData recipeData, ICategoryData categoryData)
 {
     this.recipeData   = recipeData;
     this.categoryData = categoryData;
 }
示例#24
0
 public DisplayRestaurantModel(IRestaurantData restaurantData, ICategoryData categoryData)
 {
     _restaurantData = restaurantData;
     _categoryData   = categoryData;
 }
示例#25
0
        /// <summary>
        /// Setup all tests in a selected category.
        /// </summary>
        /// <param name="cd">The category</param>
        /// <param name="continuous">Run continously</param>
        private void SetupCategoryTests(ICategoryData cd, bool continuous = false)
        {
            if (cd.ShouldRun == false)
                return;

            SetupIndividualTests(cd.Tests, continuous);
        }
示例#26
0
 /// <summary>
 /// The constructor for the class
 /// </summary>
 /// <param name="categoryData">The interface for accessing category data</param>
 public CategoryService(ICategoryData categoryData)
 {
     _CategoryData = categoryData;
 }