using System;
using System.Threading.Tasks;
using DotVVM.Framework.ViewModel;
using DotVVM.Framework.Runtime.Filters;
using ElectroShop.Services;
using ElectroShop.Models;
using System.Collections.Generic;

namespace ElectroShop.ViewModels
{
    [Authorize(Roles = "Warehouseman")]
    public class CathegoriesManagementViewModel : MasterPageViewModel
    {
        private readonly CathegoryService cathegoryService;

        public CathegoriesManagementViewModel(CathegoryService cathegoryService)
        {
            this.cathegoryService = cathegoryService;
        }

        [Bind(Direction.ServerToClient)]
        public List<ElectronicComponentCathegoryModel> Cathegories { get; set; }

        public override async Task PreRender()
        {
            Cathegories = cathegoryService.GetAllCategories();
            base.PreRender();
        }

    }
}
