public IActionResult Create(Create_product_viewmodel model) { Product product; if (ModelState.IsValid) { if (model.photo != null) { Upload_photo(model.photo); } product = new Product { Name = model.Name, Rate = 0, NewPrice = 0, Category = model.Category, photo = model.photo.FileName, Price = model.Price, ShopID = UserManager.GetUserId(HttpContext.User) }; _Iproduct.AddProduct(product); return(RedirectToAction("Index")); } return(View()); }