public static void RemoveUser() { int id = ServantClass.CheckId("Enter user ID to remove user: "******"User: {user.ShowUserInfo()}"); if (UserLogic.Remove(id)) { Console.WriteLine("User successfully removed."); } else { Console.WriteLine("Cannot to remove user."); } } else { Console.WriteLine("There are no users with this ID."); } } catch (Exception e) { Console.WriteLine("Cannot to remove user."); Console.WriteLine(e.Message); throw; } }
public static void GetUserById() { int id = ServantClass.CheckId("Enter ID number to get user by ID: "); try { User user = UserLogic.GetById(id); if (user != null) { Console.WriteLine(user.ShowUserInfo()); } else { Console.WriteLine("There are no users with this ID."); } } catch (Exception e) { Console.WriteLine("Cannot to get user by ID"); Console.WriteLine(e.Message); throw; } }
public static void RemoveAward() { int id = ServantClass.CheckId("Enter award ID to remove award: "); if (AwardLogic.Remove(id)) { Console.WriteLine("Award successfully removed."); } else { Console.WriteLine("Cannot to remove award."); } }
public static void TakeFromUser() { int userId = ServantClass.CheckId(UserIdMessage); int awardId = ServantClass.CheckId(AwardIdMessage); if (AwardLogic.TakeAward(userId, awardId)) { Console.WriteLine("Award successfully taken."); } else { Console.WriteLine("Cannot to take award."); } }
public static void GiveToUser() { int userId = ServantClass.CheckId(UserIdMessage); int awardId = ServantClass.CheckId(AwardIdMessage); if (AwardLogic.GiveAward(userId, awardId)) { Console.WriteLine("Award successfully given."); } else { Console.WriteLine("Cannot to give award."); } }
public static void AddAward() { string awardName = ServantClass.AddAwardTitle("Enter Award title: "); try { AwardLogic.Add(new Award(awardName)); Console.WriteLine("Award successfully added."); } catch (Exception e) { Console.WriteLine("Cannot to add award."); Console.WriteLine(e.Message); throw; } }
public static void AddUser() { try { string firstName = ServantClass.AddUserName(FirstNameMessage); string lasttName = ServantClass.AddUserName(LastNameMessage); DateTime birthDate = ServantClass.AddUserBirthDate(BirthDateMessage); UserLogic.Add(new User(firstName, lasttName, birthDate)); Console.WriteLine("User successfully added."); } catch (Exception e) { Console.WriteLine("Cannot to add user"); Console.WriteLine(e.Message); throw; } }
public static void UpdateUser() { int id = ServantClass.CheckId("Enter user ID to update user data: "); try { User user = UserLogic.GetById(id); if (user != null) { Console.Write("User: "******"There are no users with this ID."); return; } Console.WriteLine("Enter new user details:"); string firstName = ServantClass.AddUserName(FirstNameMessage); string lastName = ServantClass.AddUserName(LastNameMessage); DateTime birthDate = ServantClass.AddUserBirthDate(BirthDateMessage); UserLogic.Update(id, new User(firstName, lastName, birthDate)); Console.WriteLine("User successfully updated."); } catch (Exception e) { Console.WriteLine("Cannot to update user."); Console.WriteLine(e.Message); throw; } }