public MenuViewModel Build(Menu menu) { return new MenuViewModel() { MenuItems = this.handler.Storage.GetRepository<IMenuItemRepository>().FilteredByMenuId(menu.Id).Select( mi => new MenuItemViewModelBuilder(this.handler).Build(mi) ) }; }
public Menu Map(CreateOrEditViewModel createOrEdit) { Menu menu = new Menu(); if (createOrEdit.Id != null) menu = this.handler.Storage.GetRepository<IMenuRepository>().WithKey((int)createOrEdit.Id); menu.Code = createOrEdit.Code; return menu; }
public MenuViewModel Build(Menu menu) { return new MenuViewModel() { Id = menu.Id, Name = this.handler.Storage.GetRepository<ILocalizationRepository>().FilteredByDictionaryId(menu.NameId).First().Value, MenuItems = this.handler.Storage.GetRepository<IMenuItemRepository>().FilteredByMenuId(menu.Id).Select( mi => new MenuItemViewModelBuilder(this.handler).Build(mi) ) }; }