Exemple #1
0
        public void CreateElement(IEdificeElement element)
        {
            if (FindElementById(element.Id) != null)
            {
                throw new Exception("Element already exists.");
            }

            collection.Insert(element);
        }
Exemple #2
0
 public void UpdateElement(IEdificeElement element)
 {
     if (FindElementById(element.Id) == null)
     {
         throw new Exception("Element cannot be updated.");
     }
     element.UpdatedAt = DateTime.UtcNow;
     collection.Save(element);
 }
Exemple #3
0
        public static IEdificeElement FindElement()
        {
            var traceId = GetObjectIdFromTrace();

            IEdificeElement element = null;

            if (traceId != null)
            {
                element = (IEdificeElement)GetTracedObjectById(traceId.Guid);
            }

            return(element);
        }