Esempio n. 1
0
        public override bool Equals(object obj)
        {
            AccessoryTypeViewModel ac = obj as AccessoryTypeViewModel;

            if (ac == null)
            {
                return(false);
            }

            if (ac.Id != Id)
            {
                return(false);
            }
            if (ac.Name != Name)
            {
                return(false);
            }
            if (ac.Category != Category)
            {
                return(false);
            }
            if (ac.Description != Description)
            {
                return(false);
            }
            if (ac.Price != null && !Price.Equals(ac.Price))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public override void Restore()
        {
            Accessory original = Original as Accessory;

            if (original == null)
            {
                throw new InvalidOperationException(
                          "View model does not have an original value.");
            }

            if (original.Id == Guid.Empty)
            {
                Id = Guid.NewGuid();
            }
            else
            {
                Id = original.Id;
            }

            Code          = original.Code;
            AccessoryType = new AccessoryTypeViewModel(original.AccessoryType);
            Quantity      = original.Quantity;
        }