我正在尝试将db的值增加1,但由于某种原因它没有保存到db中
public void updateLockedOutCount(string email)
{
int count = 1;
tblPortalUser q = portalEntities.tblPortalUsers.Where(w => w.EmailAddress == email).FirstOrDefault();
q.loginAttempts = q.loginAttempts + count;
q.isActive = false;
_dal.portalEntities.Entry(q).State = System.Data.Entity.EntityState.Modified;
_dal.portalEntities.SaveChanges();
_dal.portalEntities.Entry(q).Reload();
}
门户网站实体只是我的上下文属性
public portalEntities _portalEntities;
public portalEntities portalEntities
{
get
{
if (_portalEntities == null)
{
try
{
_portalEntities = new portalEntities();
}
catch (Exception ex)
{
}
}
return _portalEntities;
}
}