예제 #1
0
        /// <summary>
        /// Method to add Car to Database from user input
        /// </summary>
        /// <param name="newCar"></param>
        /// <returns></returns>
        public bool AddCar(string numberPlate, string make, string model, int year, int numberOfSeats, string ownerId)
        {
            if (CarRegistrationValidationMessage(numberPlate, make, model, year, numberOfSeats, ownerId).Equals("valid"))
            {
                Guid carGuid  = Guid.NewGuid();
                User carOwner = userBusiness.GetActiveUser(ownerId);

                Car newCar = new Car(carGuid.ToString(), numberPlate, make, model, year, numberOfSeats, carOwner);

                return(carDataAccess.SetCar(newCar));
            }
            else
            {
                return(false);
            }
        }