I have a simple create action that save a product to DB. after saving the product I have used return View(new Product()); to reset the form fields but the form show the old data(the data before submit the form). Also I use return View(new Product(name="test")); but it does not work too. what is the problem? the product is saved to DB correctly (it means ModelState.IsValid is true). I don Not want to use RedirectToAction.
[HttpPost]
public ActionResult New(Product product)
{
if (ModelState.IsValid)
{
product.SubmitDate = DateTime.UtcNow;
productRepository.Add(product);
productRepository.Save();
//ViewBag.Message = "product is saved";
return View(new Product());
}
return View(product);
}