Пример #1
0
        public static FloorTO ToTranfertsObject(this FloorEF Floor)
        {
            if (Floor is null)
            {
                throw new ArgumentNullException(nameof(Floor));
            }

            return(new FloorTO
            {
                Id = Floor.Id,
                Name = Floor.Name,
            });
        }
Пример #2
0
        public static FloorTO ToTransfertObject(this FloorEF Floor)
        {
            if (Floor is null)
            {
                throw new NullFloorException(nameof(Floor));
            }

            return(new FloorTO
            {
                Id = Floor.Id,
                Number = Floor.Number,
                Archived = Floor.Archived,
            });
        }
Пример #3
0
        public static FloorEF UpdateFromDetached(this FloorEF AttachedEF, FloorEF DetachedEF)
        {
            if (AttachedEF is null)
            {
                throw new NullFloorException(nameof(AttachedEF));
            }

            if (DetachedEF is null)
            {
                throw new NullFloorException(nameof(DetachedEF));
            }

            if (AttachedEF.Id != DetachedEF.Id)
            {
                throw new Exception("Cannot update FloorEF entity as it is not the same.");
            }

            if ((AttachedEF != default) && (DetachedEF != default))
            {
                AttachedEF.Number   = DetachedEF.Number;
                AttachedEF.Archived = DetachedEF.Archived;
            }
            return(AttachedEF);
        }