/// <summary> /// Löscht den übergebenen Logeintrag /// </summary> /// <param name="logEntry"></param> public void Delete(LogEntry logEntry) { if (logEntry == null) throw new ArgumentNullException(nameof(logEntry)); GraphClient.Cypher .Match("".LogEntry("le").AnyInboundRelationsAs("r").Node("")) .Where((LogEntry le) => le.Id == logEntry.Id).Delete("le, r").ExecuteWithoutResults(); }
/// <summary> /// Lädt die VM relevanten Daten /// </summary> /// <param name="logEntry"></param> /// <returns></returns> public ILogItemViewModel LoadData(LogEntry logEntry) { if (logEntry == null) throw new ArgumentNullException(nameof(logEntry)); LogEntry = logEntry; Memo = LogEntry.Memo; Date = LogEntry.DateTime; return this; }
/// <summary> /// Speichert den Logeintrag /// </summary> /// <param name="logEntry"></param> public void Save(LogEntry logEntry) { if (logEntry == null) throw new ArgumentNullException(nameof(logEntry)); GraphClient.Cypher.Match("".LogEntry("l")) .Where((LogEntry l) => l.Id == logEntry.Id) .Set("l.Memo={Memo}, l.DateTime={Date}") .WithParams(new Dictionary<string, object> {{"Memo", logEntry.Memo}, {"Date", logEntry.DateTime}}) .ExecuteWithoutResults(); }
/// <summary> /// Erstellt einen neuen Logeintrag einer Variation /// </summary> public LogEntry Create(Variation variation, LogEntry logEntry) { ICypherFluentQuery query = GraphClient.Cypher .Match("".Variation("v")) .Where((Variation v) => v.Id == variation.Id) .Create("".Node("v").Has().LogEntryWithParam()) .WithParam("logEntry", logEntry); return query.Return(le=>le.As<LogEntry>()).Results.First(); }
public void TestDelete() { Mock<ILogEntryDao> logEntryDaoMock = new Mock<ILogEntryDao>(); logEntryDaoMock.Setup(x => x.Delete(It.IsAny<LogEntry>())); LogEntry logEntry = new LogEntry(); ILogEntryService logEntryService = new LogEntryService(logEntryDaoMock.Object); logEntryService.Delete(logEntry); logEntryDaoMock.Verify(x=>x.Delete(logEntry), Times.Once); }
/// <summary> /// Speichert einen Logeintrag /// </summary> /// <param name="logEntry"></param> public void Save(LogEntry logEntry) { if (logEntry == null) throw new ArgumentNullException(nameof(logEntry)); _logEntryDao.Save(logEntry); }
/// <summary> /// Lädt die VM relevanten Daten /// </summary> /// <param name="logEntry"></param> /// <returns></returns> public ILogItemViewModel LoadData(LogEntry logEntry) { throw new NotImplementedException(); }