I have an action that creates a certain item to the data base, after doing that it will return the same view but with a newly created view model, something like:
MyItem i = new MyItem {...}
db.MyItems.Add(i);
db.SaveChanges();
ViewBag.Message = "Item added successfully";
return View(new MyItemViewModel());
I'm doing this 'cause several items might be inserted and going back and forward can be a little annoying. The above code works as expected, the thing is that the last information inserted remains in the form despite I'm giving the view a new view model without that information. I think this is browser related but I'm not sure. I'd like to know how can I get a clean form after the insertion of an item. Thanks in advance!