I've a ASP.Net MVC 5 Application where I'm adding some data to the database. But instead of adding each one at a time, I want to add all the data that I want and at the end save all those entries to the database. But in between I want to list those provisional entries.
For example:
- Open the page with my empty list (for now) and the Add button;
- Add something and comeback to the list;
- In the list I can see that entry but is not still in the DB;
- At the end save all the entries to DB;
- In another session If I come back to this, I see those entries and can manage them the same way (having a general save and not individual);
Something like this:
public static void AddEntry(Entry e)
{
using (DBContext ctx = new DBContext())
{
ctx.Add(e);
//without Saving changes
}
}
public static void AddAll()
{
SaveChanges();
//To add all
}