Removing unneccesary loops
This commit is contained in:
@@ -512,38 +512,34 @@ namespace WD7UVN_HFT_2023241.Client
|
|||||||
|
|
||||||
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
||||||
|
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
try
|
Console.Write("Name (text): ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Email (text): ");
|
||||||
|
string email = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Phone (text): ");
|
||||||
|
string phone = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("ServiceID (integer): ");
|
||||||
|
int service_id = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
c = new Customer()
|
||||||
{
|
{
|
||||||
Console.Write("Name (text): ");
|
ID = id,
|
||||||
string name = Console.ReadLine();
|
NAME = name,
|
||||||
|
EMAIL = email,
|
||||||
|
PHONE = phone,
|
||||||
|
SERVICE_ID = service_id
|
||||||
|
};
|
||||||
|
|
||||||
Console.Write("Email (text): ");
|
RestService.Post<Customer>(c, "/api/Customer/");
|
||||||
string email = Console.ReadLine();
|
}
|
||||||
|
catch (FormatException)
|
||||||
Console.Write("Phone (text): ");
|
{
|
||||||
string phone = Console.ReadLine();
|
Console.WriteLine("Invalid format!");
|
||||||
|
|
||||||
Console.Write("ServiceID (integer): ");
|
|
||||||
int service_id = Convert.ToInt32(Console.ReadLine());
|
|
||||||
|
|
||||||
c = new Customer()
|
|
||||||
{
|
|
||||||
ID = id,
|
|
||||||
NAME = name,
|
|
||||||
EMAIL = email,
|
|
||||||
PHONE = phone,
|
|
||||||
SERVICE_ID = service_id
|
|
||||||
};
|
|
||||||
|
|
||||||
RestService.Post<Customer>(c, "/api/Customer/");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Invalid format!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void Customer()
|
public static void Customer()
|
||||||
@@ -569,42 +565,38 @@ namespace WD7UVN_HFT_2023241.Client
|
|||||||
|
|
||||||
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
||||||
|
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
try
|
Console.Write("Name (text): ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Email (text): ");
|
||||||
|
string email = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Phone (text): ");
|
||||||
|
string phone = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Team ID (integer): ");
|
||||||
|
int maintainer_id = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
Console.Write("Manager's ID (integer): ");
|
||||||
|
int manager_id = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
c = new Employee()
|
||||||
{
|
{
|
||||||
Console.Write("Name (text): ");
|
ID = id,
|
||||||
string name = Console.ReadLine();
|
NAME = name,
|
||||||
|
EMAIL = email,
|
||||||
|
PHONE = phone,
|
||||||
|
MANAGER_ID = manager_id,
|
||||||
|
MAINTAINER_ID = maintainer_id
|
||||||
|
};
|
||||||
|
|
||||||
Console.Write("Email (text): ");
|
RestService.Post<Employee>(c, "/api/Employee/");
|
||||||
string email = Console.ReadLine();
|
}
|
||||||
|
catch (FormatException)
|
||||||
Console.Write("Phone (text): ");
|
{
|
||||||
string phone = Console.ReadLine();
|
Console.WriteLine("Invalid format!");
|
||||||
|
|
||||||
Console.Write("Team ID (integer): ");
|
|
||||||
int maintainer_id = Convert.ToInt32(Console.ReadLine());
|
|
||||||
|
|
||||||
Console.Write("Manager's ID (integer): ");
|
|
||||||
int manager_id = Convert.ToInt32(Console.ReadLine());
|
|
||||||
|
|
||||||
c = new Employee()
|
|
||||||
{
|
|
||||||
ID = id,
|
|
||||||
NAME = name,
|
|
||||||
EMAIL = email,
|
|
||||||
PHONE = phone,
|
|
||||||
MANAGER_ID = manager_id,
|
|
||||||
MAINTAINER_ID = maintainer_id
|
|
||||||
};
|
|
||||||
|
|
||||||
RestService.Post<Employee>(c, "/api/Employee/");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Invalid format!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void Employee()
|
public static void Employee()
|
||||||
@@ -634,54 +626,50 @@ namespace WD7UVN_HFT_2023241.Client
|
|||||||
|
|
||||||
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
||||||
|
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
try
|
Console.Write("Name (text): ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Maintainer team's ID (integer): ");
|
||||||
|
int maintainer_id = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
Console.Write("Version (string): ");
|
||||||
|
string version = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("IP (text): ");
|
||||||
|
string ip = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Port (integer): ");
|
||||||
|
int port = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
Console.Write("Service account (text): ");
|
||||||
|
string account = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Service domain (text): ");
|
||||||
|
string domain = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Note(s) (text): ");
|
||||||
|
string notes = Console.ReadLine();
|
||||||
|
|
||||||
|
c = new Service()
|
||||||
{
|
{
|
||||||
Console.Write("Name (text): ");
|
ID = id,
|
||||||
string name = Console.ReadLine();
|
NAME = name,
|
||||||
|
MAINTAINER_ID = maintainer_id,
|
||||||
|
PORT = port,
|
||||||
|
IP = ip,
|
||||||
|
SERVICE_DOMAIN = domain,
|
||||||
|
ACCOUNT = account,
|
||||||
|
NOTES = notes,
|
||||||
|
VERSION = version
|
||||||
|
};
|
||||||
|
|
||||||
Console.Write("Maintainer team's ID (integer): ");
|
RestService.Post<Service>(c, "/api/Service/");
|
||||||
int maintainer_id = Convert.ToInt32(Console.ReadLine());
|
}
|
||||||
|
catch (FormatException)
|
||||||
Console.Write("Version (string): ");
|
{
|
||||||
string version = Console.ReadLine();
|
Console.WriteLine("Invalid format!");
|
||||||
|
|
||||||
Console.Write("IP (text): ");
|
|
||||||
string ip = Console.ReadLine();
|
|
||||||
|
|
||||||
Console.Write("Port (integer): ");
|
|
||||||
int port = Convert.ToInt32(Console.ReadLine());
|
|
||||||
|
|
||||||
Console.Write("Service account (text): ");
|
|
||||||
string account = Console.ReadLine();
|
|
||||||
|
|
||||||
Console.Write("Service domain (text): ");
|
|
||||||
string domain = Console.ReadLine();
|
|
||||||
|
|
||||||
Console.Write("Note(s) (text): ");
|
|
||||||
string notes = Console.ReadLine();
|
|
||||||
|
|
||||||
c = new Service()
|
|
||||||
{
|
|
||||||
ID = id,
|
|
||||||
NAME = name,
|
|
||||||
MAINTAINER_ID = maintainer_id,
|
|
||||||
PORT = port,
|
|
||||||
IP = ip,
|
|
||||||
SERVICE_DOMAIN = domain,
|
|
||||||
ACCOUNT = account,
|
|
||||||
NOTES = notes,
|
|
||||||
VERSION = version
|
|
||||||
};
|
|
||||||
|
|
||||||
RestService.Post<Service>(c, "/api/Service/");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Invalid format!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void Service()
|
public static void Service()
|
||||||
@@ -706,34 +694,30 @@ namespace WD7UVN_HFT_2023241.Client
|
|||||||
|
|
||||||
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
Console.WriteLine("Now you can modify these fields, except for the ID.");
|
||||||
|
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
try
|
Console.Write("Name (text): ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Email (text): ");
|
||||||
|
string email = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Leader's ID (integer): ");
|
||||||
|
int leader_id = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
c = new MaintainerTeam()
|
||||||
{
|
{
|
||||||
Console.Write("Name (text): ");
|
ID = id,
|
||||||
string name = Console.ReadLine();
|
NAME = name,
|
||||||
|
LEADER_ID = leader_id,
|
||||||
|
EMAIL = email
|
||||||
|
};
|
||||||
|
|
||||||
Console.Write("Email (text): ");
|
RestService.Post<MaintainerTeam>(c, "/api/MaintainerTeam/");
|
||||||
string email = Console.ReadLine();
|
}
|
||||||
|
catch (FormatException)
|
||||||
Console.Write("Leader's ID (integer): ");
|
{
|
||||||
int leader_id = Convert.ToInt32(Console.ReadLine());
|
Console.WriteLine("Invalid format!");
|
||||||
|
|
||||||
c = new MaintainerTeam()
|
|
||||||
{
|
|
||||||
ID = id,
|
|
||||||
NAME = name,
|
|
||||||
LEADER_ID = leader_id,
|
|
||||||
EMAIL = email
|
|
||||||
};
|
|
||||||
|
|
||||||
RestService.Post<MaintainerTeam>(c, "/api/MaintainerTeam/");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Invalid format!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void MaintainerTeam()
|
public static void MaintainerTeam()
|
||||||
|
|||||||
Reference in New Issue
Block a user