예제 #1
0
 public void InsertOrUpdate(SoftwareEntry entity)
 {
     if (entity.Id == default(int))
     {
         // New entity
         context.SoftwareEntries.Add(entity);
         Save();
         PushEventLog(
             $"Added new entry{StringUtils.Repeat(_NEWLINE_, 2) + EventLogger.FormatEntry(entity)}",
             EventLogEntryType.Information,
             220);
     }
     else
     {
         // Existing entity
         context.Entry(entity).State = System.Data.Entity.EntityState.Modified;
         Save();
         PushEventLog(
             $"Updated entry | ID: {entity.Id}",
             EventLogEntryType.Information,
             221);
     }
 }
 public void InsertOrUpdate(Approval approval)
 {
     if (approval.ID == default(int))
     {
         // New entity
         context.Approvals.Add(approval);
         Save();
         PushEventLog(
             $"Added new entry{StringUtils.Repeat(_NEWLINE_, 2) + EventLogger.FormatEntry(approval)}",
             EventLogEntryType.Information,
             220);
     }
     else
     {
         // Existing entity
         context.Entry(approval).State = System.Data.Entity.EntityState.Modified;
         Save();
         PushEventLog(
             $"Updated entry | ID: {approval.ID}" +
             $"{_NEWLINE_}Edited by: {approval.Approver}",
             EventLogEntryType.Information,
             221);
     }
 }
예제 #3
0
 public void InsertOrUpdate(LogEntry logEntry)
 {
     if (logEntry.Id == default(int))
     {
         // New entity
         context.LogEntries.Add(logEntry);
         Save();
         PushEventLog(
             $"Added new entry{StringUtils.Repeat(_NEWLINE_, 2) + EventLogger.FormatEntry(logEntry)}",
             EventLogEntryType.Information,
             666);
     }
     else
     {
         // Existing entity
         context.Entry(logEntry).State = System.Data.Entity.EntityState.Modified;
         Save();
         PushEventLog(
             $"Updated entry | ID: {logEntry.Id}" +
             $"{_NEWLINE_}Edited by: {logEntry.EditedBy}",
             EventLogEntryType.Information,
             667);
     }
 }