Пример #1
0
        private void Write()
        {
            ShowSubmenuWrite();
            var command  = _console.ReadLine();
            var employee = GetEmployeeFromCommand(command);

            while (employee == null && command != "q")
            {
                _console.WriteLine(">>неверный формат");

                ShowSubmenuWrite();
                command  = _console.ReadLine();
                employee = GetEmployeeFromCommand(command);
            }

            if (command != "q")
            {
                //_repo.AddEmployee(employee);
                reqParams.Clear();
                var settings = new JsonSerializerSettings {
                    TypeNameHandling = TypeNameHandling.All
                };
                reqParams.Add("employee", JsonConvert.SerializeObject(employee, settings));

                _request.PostRequest(_apiUrl + urlWrite, reqParams);
                _console.WriteLine(">>Готово");
            }

            _console.Write("Главное меню>");
        }