コード例 #1
0
        private Behavior.ManagerBehavior Init()
        {
            api = new Data.DataBase.ApiDb(@$ "../../../../db_example.json");

            try
            {
                api.AddNewWorker(new Data.Models.Worker
                {
                    FirstName  = "A1",
                    MiddleName = "AA1",
                    LastName   = "AAA1",
                    Login      = "******",
                    Password   = "******",
                    Role       = Data.Models.Enums.Role.Technician
                });
                api.AddNewWorker(new Data.Models.Worker
                {
                    FirstName  = "A2",
                    MiddleName = "AA2",
                    LastName   = "AAA2",
                    Login      = "******",
                    Password   = "******",
                    Role       = Data.Models.Enums.Role.Technician
                });
                api.AddNewWorker(new Data.Models.Worker
                {
                    FirstName  = "A3",
                    MiddleName = "AA3",
                    LastName   = "AAA3",
                    Login      = "******",
                    Password   = "******",
                    Role       = Data.Models.Enums.Role.Manager
                });
            }
            catch
            {
            }

            return(new Behavior.ManagerBehavior(
                       api.GetAllWorkers().Where(x => x.Role == Data.Models.Enums.Role.Manager).ToList()[0], api));
        }
コード例 #2
0
        private void Init()
        {
            api = new Data.DataBase.ApiDb(@$ "../../../../db_example.json");

            try
            {
                api.AddNewWorker(new Models.Worker
                {
                    FirstName  = "A1",
                    MiddleName = "AA1",
                    LastName   = "AAA1",
                    Login      = "******",
                    Password   = "******",
                    Role       = Models.Enums.Role.Technician
                });
                api.AddNewWorker(new Models.Worker
                {
                    FirstName  = "A2",
                    MiddleName = "AA2",
                    LastName   = "AAA2",
                    Login      = "******",
                    Password   = "******",
                    Role       = Models.Enums.Role.Technician
                });
                api.AddNewWorker(new Models.Worker
                {
                    FirstName  = "A3",
                    MiddleName = "AA3",
                    LastName   = "AAA3",
                    Login      = "******",
                    Password   = "******",
                    Role       = Models.Enums.Role.Manager
                });
            }
            catch
            {
            }
        }