public IActionResult CreateItem(IEnumerable <int> CategoryIds, IEnumerable <int> ManufacturerIds,
                                        CreateItemViewModel itemToCreate)
        {
            using (var client = new HttpClient())
            {
                var item = new Item()
                {
                    Id          = itemToCreate.Item.Id,
                    Description = itemToCreate.Item.Description,
                    Title       = itemToCreate.Item.Title,
                    Price       = itemToCreate.Item.Price,
                    Color       = itemToCreate.Item.Color,
                    Weight      = itemToCreate.Item.Weight,
                    Size        = itemToCreate.Item.Size


                                  //books?authId=?&authId=?&catId=?
                };

                var uriParameters = GetManufacturersCategoriesUri(ManufacturerIds.ToList(), CategoryIds.ToList());

                client.BaseAddress = new Uri("http://localhost:62352/api/");
                var responseTask = client.PostAsJsonAsync($"items?{uriParameters}", item);
                responseTask.Wait();

                var result = responseTask.Result;

                if (result.IsSuccessStatusCode)
                {
                    var readTaskNewItem = result.Content.ReadAsAsync <Item>();
                    readTaskNewItem.Wait();

                    var newItem = readTaskNewItem.Result;

                    TempData["SuccessMessage"] = $"Item {item.Title} was successfully created.";
                    return(RedirectToAction("GetItemById", new { itemId = newItem.Id }));
                }
            }

            var categoryList     = new CategoriesList(_categoryRepository.GetCategories().ToList());
            var manufacturerList = new ManufacturersList(_manufacturerRepository.GetManufacturers().ToList());

            itemToCreate.CategorySelectListItems     = categoryList.GetCategoriesList(CategoryIds.ToList());
            itemToCreate.ManufacturerSelectListItems = manufacturerList.GetManufacturersList(ManufacturerIds.ToList());
            itemToCreate.CategoryIds     = CategoryIds.ToList();
            itemToCreate.ManufacturerIds = ManufacturerIds.ToList();

            return(View(itemToCreate));
        }
        public IActionResult CreateItem()
        {
            var manufacturers = _manufacturerRepository.GetManufacturers();
            var categories    = _categoryRepository.GetCategories();



            var manufacturerList = new ManufacturersList(manufacturers.ToList());
            var categoryList     = new CategoriesList(categories.ToList());

            var createUItem = new CreateItemViewModel
            {
                ManufacturerSelectListItems = manufacturerList.GetManufacturersList(),
                CategorySelectListItems     = categoryList.GetCategoriesList()
            };

            return(View(createUItem));
        }