public void DeleteLogById(int id) { using (var context = new ObjectTransferDBEntities()) { context.Logs.Remove((from logs in context.Logs where logs.ID == id select logs).FirstOrDefault()); context.SaveChanges(); } }
public void WriteError(string message) { using (var context = new ObjectTransferDBEntities()) { context.Logs.Add( new Logs { Message = message, Date = DateTime.Now, MessageType = true, StackTrace = null, }); context.SaveChanges(); } }
public void WriteInfo(string message) { using (var context = new ObjectTransferDBEntities()) { Console.WriteLine("пишу лог"); context.Logs.Add( new Logs { Message = message, Date = DateTime.Now, MessageType = false, StackTrace = null, }); Console.WriteLine("сохраняю лог в базу"); context.SaveChanges(); } }