public override void Restore() { MuntinType original = Original as MuntinType; if (original == null) { throw new InvalidOperationException( "View model does not have an original value."); } Id = original.Id; Name = original.Name; Width = original.Width; Weight = original.Weight; Height = original.Height; Price = original.Price; Tolerance = original.Tolerance; Description = original.Description; }
public static MuntinType ToModel(this MuntinTypeViewModel muntinTypeViewModel) { if (muntinTypeViewModel == null) { throw new ArgumentNullException("muntinTypeViewModel"); } MuntinType muntinType = new MuntinType(); muntinType.Id = muntinTypeViewModel.Id; muntinType.Name = muntinTypeViewModel.Name; muntinType.Width = muntinTypeViewModel.Width; muntinType.Weight = muntinTypeViewModel.Weight; muntinType.Height = muntinTypeViewModel.Height; muntinType.Price = muntinTypeViewModel.Price; muntinType.Description = muntinTypeViewModel.Description; muntinType.Tolerance = muntinTypeViewModel.Tolerance; return(muntinType); }
public MuntinTypeViewModel(MuntinType muntinType) { Original = muntinType; Restore(); }