public IActionResult Create(CreateBikeViewModel createBike) { if (ModelState.IsValid) { var bike = _mapper.Map <Product>(createBike); var fileName = GetPhotoPath(createBike); bike.ProductPhoto = fileName; _productsRepo.CreateProduct(bike); return(RedirectToAction("Details", new { id = bike.ProductId })); } ViewBag.Brands = new SelectList(_brandsRepo.GetBrands(), "BrandName", "BrandName"); ViewBag.Categories = new SelectList(_categoriesRepo.GetCategories(), "CategoryName", "CategoryName"); return(View(createBike)); }