Exemplo n.º 1
0
 public static ItemModel Map(this ItemsBlockViewModel model)
 {
     return(new ItemModel(model.Name, model.Type != null
                                 ? (ItemType)Enum.Parse(typeof(ItemType), model.Type)
                                 : ItemType.Amount,
                          model.Amount, model.Categories, model.Active));
 }
Exemplo n.º 2
0
        public static ItemsBlockViewModel Map(this ItemModel model)
        {
            var result = new ItemsBlockViewModel()
            {
                Name       = model.Name,
                Amount     = model.Amount,
                Active     = model.Active,
                Categories = model.Categories,
                Type       = Enum.GetName(typeof(ItemType), model.Type)
            };

            result.SetValidationResult(model.ValidationResult);

            return(result);
        }