private void CreateNewData(InternalReferenceObject internalReferenceObject) { var data = new Data(); SetDataMessage(internalReferenceObject, data); m_Data.Add(internalReferenceObject.Id, data); }
private void ModifyData(InternalReferenceObject internalReferenceObject) { var data = m_Data[internalReferenceObject.Id]; SetDataMessage(internalReferenceObject, data); m_Data.Remove(internalReferenceObject.Id); m_Data.Add(internalReferenceObject.Id, data); }
private static void SetDataMessage(InternalReferenceObject internalReferenceObject, Data data) { var message = new Message { data = GetJsonData(internalReferenceObject.Body) }; switch (internalReferenceObject.Relation) { case "left": data.DataLeft = message; break; case "right": data.DataRight = message; break; } }
public bool StoreData(string id, string relation, Stream bodyStream) { var body = bodyStream.ConvertToString(); var internalReferenceObject = new InternalReferenceObject { Id = id, Relation = relation, Body = body }; if (!supportedRelation.Contains(relation) || !ValidInput(body)) { return(false); } if (IsExists(id)) { ModifyData(internalReferenceObject); } else { CreateNewData(internalReferenceObject); } return(true); }