예제 #1
0
        public static void GetEnterprise(long id)
        {
            var enterpriseRequest = new EnterpriseRequestHandler();
            var resp = enterpriseRequest.DeleteEnterprise(id).Result;

            Console.WriteLine(resp);
        }
예제 #2
0
        public static void PutEnterprise(EnterpriseUpdateModel model)
        {
            var enterpriseRequest = new EnterpriseRequestHandler();
            var resp = enterpriseRequest.UpdateEnterprise(model).Result;

            Console.WriteLine(resp);
        }
예제 #3
0
        public static void PostEnterprise(EnterpriseCreateModel model)
        {
            var request    = new EnterpriseRequestHandler();
            var enterprise = new EnterpriseCreateModel();

            enterprise.Name = model.Name;
            enterprise.EstablishmentYear = model.EstablishmentYear;
            enterprise.Employees         = new List <EmployeeCreateModel>();
            if (model.Employees != null)
            {
                var list = model.Employees.ToList();
                for (int i = 0; i < model.Employees.Count; ++i)
                {
                    var employee = new EmployeeCreateModel();
                    employee.Firstname   = list[i].Firstname;
                    employee.Lastname    = list[i].Lastname;
                    employee.DateOfBirth = list[i].DateOfBirth;
                    employee.JobTitle    = list[i].JobTitle;
                    enterprise.Employees.Add(employee);
                }
            }
            var res = request.CreateCompany(enterprise).Result;

            Console.WriteLine(res);
        }
예제 #4
0
        public static void PrintAllJsonEnterprise()
        {
            var enterpriseRequest = new EnterpriseRequestHandler();
            var json         = enterpriseRequest.LoadEnterpriseJson();
            var deserialised = JsonConvert.DeserializeObject <IEnumerable <EnterpriseModel> >(json.Result);
            var pretty       = JsonConvert.SerializeObject(deserialised, Formatting.Indented);

            Console.WriteLine(pretty);
        }
예제 #5
0
 public async static void DeleteEnterprise(long id)
 {
     try
     {
         var enterpriseRequest = new EnterpriseRequestHandler();
         Console.WriteLine(await enterpriseRequest.DeleteEnterprise(id));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }