public bool Save() { if (_db.SaveChanges() > 0) { return(true); } else { return(false); } }
private static void SaveChangeToDatabase(Microsoft.EntityFrameworkCore.DbContext context) { try { context.SaveChanges(); } catch (Exception e) { Console.WriteLine(e.GetBaseException()); } }
protected override void AfterInsert(RfidCard item, Microsoft.EntityFrameworkCore.DbContext dbContext) { CardIssue issue = new CardIssue(); issue.CardNo = item.RfidNo; issue.CardId = item.RecordId; issue.WorkstationId = -1; issue.WorkstationCode = ""; issue.WorkstationName = ""; SystemUser currentUser = GlobalConstants.GetCurrentUser(); issue.IssueUserId = currentUser.RecordId; issue.IssueUserCode = currentUser.UserCode; issue.IssueUserName = currentUser.UserName; issue.IssueQty = item.IssueQty; dbContext.Add(issue); dbContext.SaveChanges(); }
/// <summary> /// Saves the changes. /// </summary> public void SaveChanges() { _context.SaveChanges(); }