public async Task <IActionResult> Create(CreateClothesViewModel clothesModel)
        {
            if (ModelState.IsValid)
            {
                var clothes = await _clothesStore.Create(clothesModel.Entity);

                await HttpContext.WriteImageClothes(_enviroments, clothesModel.Entity);

                await _clothesStore.Update(clothes);

                return(RedirectToReturnUrlOrHome(clothesModel.ReturnUrl));
            }
            return(View(clothesModel));
        }
        public async Task <IActionResult> Create(string type, string category, string returnUrl)
        {
            var brands = await _brands.GetAll();

            if (!brands.Any())
            {
                return(RedirectToAction("Error", "Home", new { message = "Неможливо додати одяг, немає брендів!" }));
            }
            var clothes      = new Clothes();
            var clothesTypes = await _clothes.GetClothesTypesByCategory(category);

            clothes.ClothesTypeId = clothesTypes.FirstOrDefault(e => e.Name == type).Id;
            var model = new CreateClothesViewModel()
            {
                Entity = clothes, ReturnUrl = returnUrl, Brands = brands
            };

            return(View(model));
        }