private static async Task AddEmployee(EmployeDecorator employDeco) { var parameters = await employDeco.GetAllParameters(); List <EmployeNode> entity = new List <EmployeNode>(); foreach (var param in parameters) { Console.WriteLine("Enter : " + param); EmployeNode nodeName = new EmployeNode { Key = "name", Value = Console.ReadLine() }; entity.Add(nodeName); } var resultAdd = await employDeco.AddEmployee(entity); if (!resultAdd.Failure) { Console.WriteLine("Record added successfully for employe :" + resultAdd.OutputObject[0].Value); } else { Console.WriteLine(resultAdd.Errors[0].ErrorMessage); } }
private static async Task AddEmployee(IEmployeeOperation employee) { Console.WriteLine("Enter Name, age and designation"); List <EmployeNode> entity = new List <EmployeNode>(); EmployeNode nodeName = new EmployeNode { Key = "name", Value = Console.ReadLine() }; entity.Add(nodeName); EmployeNode nodeAge = new EmployeNode { Key = "age", Value = Console.ReadLine() }; entity.Add(nodeAge); EmployeNode nodeDesignation = new EmployeNode { Key = "designation", Value = Console.ReadLine() }; entity.Add(nodeDesignation); var resultAdd = await employee.AddEmployee(entity, Constant.FilePath); if (!resultAdd.Failure) { Console.WriteLine("Record added successfully for employe :" + resultAdd.OutputObject[0].Value); } else { Console.WriteLine(resultAdd.Errors[0].ErrorMessage); } }