/// <summary> /// Gets new carsale from controller and transfers data to repo /// Takes in the date of today to get the time of application /// </summary> /// <param name=”newCarSale”> /// Parameter newCarSale requires a CarSaleViewModel argument. /// </param> /// <returns> /// Boolean /// True if the car was added /// False if something went wrong /// </returns> public bool AddCarSale(CarSaleViewModel newCarSale) { Console.WriteLine("IN SERVICE"); DateTime now = new DateTime(); // Date at time of application CarSale carSale = new CarSale { Name = newCarSale.Name, SSN = newCarSale.SSN, Email = newCarSale.Email, Address = newCarSale.Address, PhoneNum = newCarSale.PhoneNum, Webpage = newCarSale.Webpage, Accepted = false, Active = false, DateOfApplication = now }; var res = _repo.AddCarSale(carSale); if (res == true) { // If the carsale was added successfully, we want to send email to the admin to notify var email = _email.CreateAdminEmail(newCarSale); _email.SendEmail(email); return(res); } else { return(false); } }