private static Employee GetEmployeeObject(int id, string name, string remarkText) { Employee employee = GetEmployeeObject(id, name); Remark remark = new Remark(); remark.RemarkText = remarkText; remark.RemarkDate = DateTime.Now; employee.Remarks = new List <Remark>(); employee.Remarks.Add(remark); return(employee); }
public void AddRemark(int id, string remarkText) { if (_employees.Any(emp => emp.Id == id)) { Employee employee = _employees.Single(emp => emp.Id == id); Remark remark = new Remark(); remark.RemarkDate = DateTime.Now; remark.RemarkText = remarkText; employee.Remarks.Add(remark); } else { ResultNotFoundFault fault = new ResultNotFoundFault { FaultId = 102, Message = "Employee with Id " + id + " does not exist" }; throw new FaultException <ResultNotFoundFault>(fault, "Employee with Id " + id + " does not exist"); } }