Example #1
0
        public static User NewUser()
        {
            Console.Clear();
            User user = new User();

            Console.Write(Constant.UserId);
            user.Id = Helper.GetValidUserName();

            Console.Write(Constant.Password);
            user.Password = Helper.ValidString();

            Console.Write(Constant.Name);
            user.Name = Helper.ValidString();

            Console.Write(Constant.MobileNumber);
            user.MobileNumber = Helper.ValidString();

            Console.Write(Constant.Email);
            user.Email = Helper.GetValidEmail();

            Console.Write(Constant.Address);
            user.Address = Helper.ValidString();

            Console.Write(Constant.DrivingLicenceNumber);
            user.DrivingLicence = Console.ReadLine();

            Console.Write(Constant.IdProofNumber);
            user.IdProofNumber = Helper.ValidString();

            return(user);
        }
        public void UpdateMenu()
        {
            Console.WriteLine(Constant.UpdateUserDetailOptions);
            User user = AppDataService.Users?.FirstOrDefault(a => a.Id == this.Id);
            UpdateUserDetailMenu op = (UpdateUserDetailMenu)Helper.ValidInteger();

            switch (op)
            {
            case UpdateUserDetailMenu.Name:
                user.Name = Helper.ValidString();
                break;

            case UpdateUserDetailMenu.Mobile:
                user.Mobile = Console.ReadLine();
                break;

            case UpdateUserDetailMenu.Email:
                user.Email = Helper.GetValidEmail();
                break;

            case UpdateUserDetailMenu.Address:
                user.Address = Console.ReadLine();
                break;

            case UpdateUserDetailMenu.DrivingLicence:
                user.DrivingLicence = Console.ReadLine();
                break;

            case UpdateUserDetailMenu.Signout:
                Program.MainMenu();
                break;

            case UpdateUserDetailMenu.Exit:
                Environment.Exit(0);
                break;
            }
        }