public async Task <IActionResult> Post(BrandIndexViewModel model)
        {
            var brand = new Brand
            {
                Id          = model.Id,
                Name        = model.Name,
                Description = model.Description
            };
            await _brandRepository.AddAsync(brand);

            TempData["SM"] = "Вы успешно создали.";
            return(RedirectToAction("Index", "Brand"));
        }
        public async Task <IActionResult> Get(int id)
        {
            var brand = await _brandRepository.GetByIdAsync(id);

            var model = new BrandIndexViewModel
            {
                Id          = brand.Id,
                Name        = brand.Name,
                Description = brand.Description
            };

            return(View(model));
        }
        public async Task <IActionResult> Put(int id, BrandIndexViewModel model)
        {
            var brand = await _brandRepository.GetByIdAsync(id);

            if (brand == null)
            {
                return(NotFound());
            }

            model.Name        = brand.Name;
            model.Description = brand.Description;

            return(View(model));
        }
        public async Task <IActionResult> Put(BrandIndexViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(NotFound());
            }

            var brand = new Brand
            {
                Id          = model.Id,
                Name        = model.Name,
                Description = model.Description
            };

            await _brandRepository.UpdateAsync(brand);

            TempData["SM"] = "Вы успешно изменили.";

            return(RedirectToAction("Index"));
        }