public IActionResult Create(BrandViewModel model) { if (ModelState.IsValid) { ProductBrand brand = _mapper.Map <BrandViewModel, ProductBrand>(model); _departmentRepository.CreateBrand(brand); return(RedirectToAction("index")); } return(View(model)); }