c# - What is wrong with this Entity Framework code? (add some entity) -


public class calendar {     databasecontext db = new databasecontext();      public list<day> getdays()     {         user user = user(session["user"]);         return user.days.tolist();     }      public void addday()     {         user user = user(session["user"]);         var day = new day { date = datetime.now, userid = user.userid };         db.days.add(day);         db.savechanges();     } } 

i call getdays method first , returns list count = 3.

then call addday method , call getdays method again , count still 3!

please me. what's wrong?


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -