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
Post a Comment