Exemplo n.º 1
0
        /// <summary>
        /// This method adds the component to the database
        /// Overwrites the component if a component with the uid already exists.
        /// </summary>
        /// <param name="component">The component to add</param>
        /// <returns></returns>
        public async Task CreateNewComponent(HardwareComponent component)
        {
            if (Components != null)
            {
                if (!Components.ContainsKey(component.componentUid))
                {
                    Components.Add(component.componentUid, component);
                    await Model.AddComponent(component);
                }
                else
                {
                    Components.Remove(component.componentUid);
                    Components.Add(component.componentUid, component);

                    await Model.UpdateHardwareComponent(component);
                }
            }
            else
            {
                Components = new Dictionary <string, HardwareComponent>
                {
                    { component.componentUid, component }
                };
                await Model.AddComponent(component);
            }
        }
Exemplo n.º 2
0
 public async Task UpdateComponent(HardwareComponent component)
 {
     throw new NotImplementedException();
 }