public void CreateElement(IEdificeElement element) { if (FindElementById(element.Id) != null) { throw new Exception("Element already exists."); } collection.Insert(element); }
public void UpdateElement(IEdificeElement element) { if (FindElementById(element.Id) == null) { throw new Exception("Element cannot be updated."); } element.UpdatedAt = DateTime.UtcNow; collection.Save(element); }
public static IEdificeElement FindElement() { var traceId = GetObjectIdFromTrace(); IEdificeElement element = null; if (traceId != null) { element = (IEdificeElement)GetTracedObjectById(traceId.Guid); } return(element); }