public static void Update(SecLoginLog secloginlogMaster) { /*changed after DB changes*/ // var querySecLoginLog = //from secloginlog in DbContextHelper.DbContext.SecLoginLogs //where // ((from secloginlog0 in DbContextHelper.DbContext.SecLoginLogs // where // secloginlog0.userid == secloginlogMaster.userid // orderby // secloginlog0.logid descending // select new // { // secloginlog0.logid // }).Take(1)).Contains(new { secloginlog.logid }) // select secloginlog; // foreach (var secloginlog in querySecLoginLog) // { // secloginlog.logouttime = DateTime.Now; // } // DbContextHelper.DbContext.SaveChanges();var querySecLoginLog = var querySecLoginLog = from secloginlog in DbContextHelper.DbContext.SecLoginLog where ((from secloginlog0 in DbContextHelper.DbContext.SecLoginLog where secloginlog0.UserId == secloginlogMaster.UserId orderby secloginlog0.LogId descending select new { secloginlog0.LogId }).Take(1)).Contains(new { secloginlog.LogId }) select secloginlog; foreach (var secloginlog in querySecLoginLog) { secloginlog.LogoutTime = DateTime.Now; } DbContextHelper.DbContext.SaveChanges(); }
public static void Save(SecLoginLog secloginlogMaster) { /*changed after DB changes*/ //if (secloginlogMaster.logid == 0) if (secloginlogMaster.LogId == 0) { DbContextHelper.DbContext.Add(secloginlogMaster); } DbContextHelper.DbContext.SaveChanges(); }