public void AddNewLocation() { //gather information about the new location Console.WriteLine("Please enter the details of the new location"); string name = _validationService.ValidateString("Enter a unique name for the location"); string address = _validationService.ValidateString("Enter the address for the location"); using (var log = new LoggerConfiguration().MinimumLevel.Debug().WriteTo.Console().WriteTo.File("../logs/logs.txt", rollingInterval: RollingInterval.Day).CreateLogger()) { try { //create new location object and send it over to BL Location newLoc = new Location(name, address); Location createdLoc = _locBL.AddNewLocation(newLoc); Console.WriteLine("Location Creation has been successful!"); Console.WriteLine(createdLoc.ToString()); } catch (Exception ex) { log.Warning(ex.Message); } } }
public void AddNewProduct() { Console.WriteLine("Enter details about the new product"); string name = _validationService.ValidateString("Name: "); string desc = _validationService.ValidateString("Description: "); double price = _validationService.ValidateDouble("Price: "); string category = _validationService.ValidateString("Category: "); using (var log = new LoggerConfiguration().MinimumLevel.Debug().WriteTo.Console().WriteTo.File("../logs/logs.txt", rollingInterval: RollingInterval.Day).CreateLogger()) { try { Product newProd = new Product(name, desc, price, category); Product createdProd = _productBL.AddNewProduct(newProd); Console.WriteLine("Product added successfully"); Console.WriteLine(createdProd.ToString()); } catch (Exception ex) { log.Warning(ex, ex.Message); } } }
public Customer Start() { string name = _validationService.ValidateString("Please enter your name:"); return(CreateNewCustomer(name)); }