public async Task <IActionResult> Add(MenuItem menuItem)
        {
            string AddMenuItemUri = $"{Configuration["RestaurantServiceEndpoint"]}/MenuItem/Add";
            var    response       = await HttpRequestClient.PostRequest <AddResponseModel>(AddMenuItemUri, menuItem);

            menuItem.Id = response.Id;

            string AddMenuItemForCustomerMicroserviceUri = $"{Configuration["CusotmerServiceEndpoint"]}/MenuItem/Add";
            await HttpRequestClient.PostRequest <object>(AddMenuItemForCustomerMicroserviceUri, menuItem);

            string AddMenuItemForOrderMicroserviceUri = $"{Configuration["OrderServiceEndpoint"]}/MenuItem/Add";
            await HttpRequestClient.PostRequest <object>(AddMenuItemForOrderMicroserviceUri, menuItem);

            return(Ok());
        }
Пример #2
0
        public async Task <IActionResult> AddCustomer(Customer customer)
        {
            User user = new User()
            {
                Email    = customer.Email,
                Password = customer.Password,
                Role     = UserRole.Customer
            };
            string AddUserUri = $"{Configuration["AuthorizationServiceEndpoint"]}/Users/Add";
            await HttpRequestClient.PostRequest <object>(AddUserUri, user);

            string AddCustomerUri = $"{Configuration["CusotmerServiceEndpoint"]}/Customers/Add";
            await HttpRequestClient.PostRequest <object>(AddCustomerUri, customer);

            return(Ok());
        }
Пример #3
0
        public async Task <IActionResult> AddDriverUser(Driver driver)
        {
            User user = new User()
            {
                Email    = driver.Email,
                Password = driver.Password,
                Role     = UserRole.Driver
            };
            string AddUserUri = $"{Configuration["AuthorizationServiceEndpoint"]}/Users/Add";
            await HttpRequestClient.PostRequest <object>(AddUserUri, user);

            string AddDriverUri = $"{Configuration["DriverServiceEndpoint"]}/Drivers/Add";
            var    response     = await HttpRequestClient.PostRequest <AddResponseModel>(AddDriverUri, driver);

            driver.Id = response.Id;

            string AddDriverForOrderMicroserviceUri = $"{Configuration["OrderServiceEndpoint"]}/Drivers/Add";
            await HttpRequestClient.PostRequest <object>(AddDriverForOrderMicroserviceUri, driver);

            return(Ok());
        }
Пример #4
0
        public async Task <IActionResult> AddRestaurantUser(Restaurant restaurant)
        {
            User user = new User()
            {
                Email    = restaurant.Email,
                Password = restaurant.Password,
                Role     = UserRole.Restaurant
            };
            string AddUserUri = $"{Configuration["AuthorizationServiceEndpoint"]}/Users/Add";
            await HttpRequestClient.PostRequest <object>(AddUserUri, user);

            string AddRestaurantUri = $"{Configuration["RestaurantServiceEndpoint"]}/Restaurant/Add";
            var    response         = await HttpRequestClient.PostRequest <AddResponseModel>(AddRestaurantUri, restaurant);

            restaurant.Id = response.Id;

            string AddRestaurantInCustomerServiceUri = $"{Configuration["CusotmerServiceEndpoint"]}/Restaurant/Add";
            await HttpRequestClient.PostRequest <object>(AddRestaurantInCustomerServiceUri, restaurant);

            string AddRestaurantInOrderServiceUri = $"{Configuration["OrderServiceEndpoint"]}/Restaurant/Add";
            await HttpRequestClient.PostRequest <object>(AddRestaurantInOrderServiceUri, restaurant);

            return(Ok());
        }