Ejemplo n.º 1
0
        public void Execute(CreateMenuModel model)
        {
            var date = _dateService.GetDate();

            var menuModel = new MenusListItemModel();

            menuModel.Id       = Guid.NewGuid();
            menuModel.Name     = model.Name;
            menuModel.Icon     = model.Icon;
            menuModel.Url      = model.Url;
            menuModel.Created  = date;
            menuModel.Modified = date;
            menuModel.MenuType = model.MenuType;
            menuModel.NoOrder  = model.NoOrder;

            var menu = _factory.Create(menuModel);

            _database.Menus.Add(menu);

            _database.Save();
        }
Ejemplo n.º 2
0
        public Menu Create(MenusListItemModel menuModel)
        {
            var menu = new Menu();

            menu.Id = menuModel.Id.Value;

            menu.Name = menuModel.Name;

            menu.Icon = menuModel.Icon;

            menu.Url = menuModel.Url;

            menu.NoOrder = menuModel.NoOrder.Value;

            menu.Created = DateTime.Now;

            menu.Modified = DateTime.Now;

            menu.ParentId = menuModel.ParentId.Value;
            // Note: Total price is calculated in domain logic
            menu.CreatedBy  = menuModel.CreatedBy.Value;
            menu.ModifiedBy = menuModel.ModifiedBy.Value;
            return(menu);
        }