public static bool AddRow(DataTable table, string Msg) { Console.Write("Enter the user's details. Data separator '|'. " + $"\n Format: name|surname|year of birth|phone number|{Msg} : \n"); string txt = Console.ReadLine(); string[] Arr = txt.Split("|"); if (Arr.Length != 5) { Console.WriteLine("the data entered is incorrect"); return(false); } else { return(AddRowMethods[table.TableName](Arr)); } }
public static bool AddRowForReplace(DataTable table, string Id) { bool result = false; Console.Write("Enter the new user's details. Data separator '|'. " + "\n Format: name|surname|year of birth|phone number : \n"); string txt = Console.ReadLine(); string[] Arr = txt.Split("|"); Array.Resize(ref Arr, Arr.Length + 1); Arr[Arr.Length - 1] = Id; if (Arr.Length != 5) { Console.WriteLine("the data entered is incorrect"); } else { if (AddRowMethods[table.TableName](Arr)) { return(true); } } return(result); }