public IActionResult OnGet([FromServices] GetCustomerInformation getCustomerInformation) { //Get Cart var information = getCustomerInformation.Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "A", LastName = "A", Address1 = "A", Address2 = "A", City = "A", State = "A", Zipcode = "A", Email = "*****@*****.**", PhoneNumber = "11", }; } return(Page()); } else { return(RedirectToPage("Payment")); } }
public IActionResult OnGet( [FromServices] GetCustomerInformation getCustomerInformation) { var information = getCustomerInformation.Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "First", LastName = "Last", Email = "*****@*****.**", PhoneNumber = "5555555555", Address1 = "123 Fake Street", Address2 = "Apartment A", City = "Beverly Hills", State = "CA", ZipCode = "90210", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet( [FromServices] GetCustomerInformation getCustomerInformation) { var information = getCustomerInformation.Do(); if (information == null) { // #region DevEnvOnly if (_environment.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "devTest", LastName = "devTest", Email = "*****@*****.**", PhoneNumber = "1111", Address1 = "devTest", Address2 = "devTest", City = "devTest", PostCode = "devTest" }; } #endregion // return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet() { var customerInformation = new GetCustomerInformation(HttpContext.Session).Do(); if (customerInformation == null) { if (_env.IsDevelopment()) { CustomerInfo = new AddCustomerInformation.Request { FirstName = "A", LastName = "A", Address1 = "A", Address2 = "A", City = "A", Email = "*****@*****.**", PhoneNo = "222", PostCode = "A" }; } return(Page()); } return(RedirectToPage("Payment")); }
public IActionResult OnGet() { var information = new GetCustomerInformation(HttpContext.Session).Do(); if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "Mhd", LastName = "Zamel", Address1 = "Dubai", Address2 = "Ajman", City = "Damascus", Email = "*****@*****.**", PhoneNumber = "0505838490", PostalCode = "00000" }; } if (information == null) { return(Page()); } else { return(RedirectToPage("/CheckOut/Payment")); } }
public void AddCustomerInformationTest() { var request = new AddCustomerInformation.Request { FirstName = "Bob", LastName = "Smith", Email = "*****@*****.**", PhoneNumber = "375123092723", Address1 = "Lenina street 12", Address2 = "", City = "Minsk", PostCode = "220000" }; var mock = new Mock <ISessionManager>(); new AddCustomerInformation(mock.Object).Do(request); mock.Verify(x => x.AddCustomerInformation(It.Is <CustomerInformation>(y => y.FirstName == request.FirstName && y.LastName == request.LastName && y.Email == request.Email && y.PhoneNumber == request.PhoneNumber && y.Address1 == request.Address1 && y.Address2 == request.Address2 && y.City == request.City && y.PostCode == request.PostCode )), Times.Once); }
public IActionResult OnGet() { var information = new GetCustomerInformation(HttpContext.Session).Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "John", LastName = "Doe", Email = "*****@*****.**", PhoneNumber = "(000) 000-0000", Address1 = "1234 Bangalore Road", Address2 = "", City = "Bangalore", PostCode = "12345", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet() { var information = new GetCustomerInformation(HttpContext.Session).Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "A", LastName = "A", Email = "[email protected]", PhoneNumber = "11", Address1 = "A", Address2 = "A", City = "A", PostCode = "A", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet([FromServices] GetCustomerInformation getCustomerInformation) { var info = getCustomerInformation.Do(); if (info == null) { if (_env.IsDevelopment()) { CustomerInfo = new AddCustomerInformation.Request { FirstName = "FirstName", LastName = "LastName", Email = "*****@*****.**", PhoneNumber = "123", Address1 = "Address1", Address2 = "Address2", City = "City", PostCode = "PostCode", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet() { // get customer info var information = new GetCustomerInformation(_sessionManager).Do(); if (information == null) { if (_env.EnvironmentName == "Development") { CustomerInformation = new AddCustomerInformation.Request() { FirstName = "Andrew", LastName = "Smith", Email = "*****@*****.**", PhoneNumber = "+722222222", Address1 = "Somewhere", Address2 = "Nowhere", City = "Moscow", PostCode = "123" }; } return(Page()); } // if info exist go to payment return(RedirectToPage("/Checkout/Payment")); }
public IActionResult OnGet() { var information = new GetCustomerInformation(HttpContext.Session).Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { Name = "Test Name", Email = "*****@*****.**", PhoneNumber = "12", Address = "Test Address", Neighborhood = "Test Neighborhood", City = "Test City", State = "Test State", ZipCode = "Test Zipcode" }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet() { var information = new GetCustomerInformation(HttpContext.Session).Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "Daniel", LastName = "Sivewright", Email = "*****@*****.**", PhoneNumber = "0725077755", Address1 = "20 Alexis Preller", Address2 = "", City = "Johannesburg", PostCode = "2055", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet( [FromServices] GetCustomerInformation getCustomerInformation) { // Get Cart var information = getCustomerInformation.Do(); // If Cart exist go to payment if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "Jaime", LastName = "Barras", Email = "*****@*****.**", PhoneNumber = "(866) 555-1234", Address1 = "Home Address", Address2 = "Office Address", City = "New York", ZipCode = "25078", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet() { //Get Cart //If cart exists, then go to payment var information = new GetCustomerInformation(HttpContext.Session).Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "ff", LastName = "ll", Email = "ee@ee", PhoneNumber = "0125421", Address1 = "add1", Address2 = "add2", City = "nz city", PostCode = "5510", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
public IActionResult OnGet( [FromServices] GetCustomerInformation getCustomerInformation) { var information = getCustomerInformation.Do(); if (information == null) { if (_env.IsDevelopment()) { CustomerInformation = new AddCustomerInformation.Request { FirstName = "Jan", LastName = "Kowalski", Email = "*****@*****.**", PhoneNumber = "111222333", Address1 = "Cebulowa", Address2 = "21/37", City = "Radom", PostCode = "33-666", }; } return(Page()); } else { return(RedirectToPage("/Checkout/Payment")); } }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var cities = new List <string>(); cities.Add("Alba Iulia"); cities.Add("Arad"); cities.Add("Pitesti"); cities.Add("Bacau"); cities.Add("Oradea"); cities.Add("Bistrita"); cities.Add("Botosani"); cities.Add("Braila"); cities.Add("Brasov"); cities.Add("Buzau"); cities.Add("Calarasi"); cities.Add("Resita"); cities.Add("Cluj-Napoca"); cities.Add("Constanta"); cities.Add("Sfantu Gheorghe"); cities.Add("Targoviste"); cities.Add("Craiova"); cities.Add("Galati"); cities.Add("Giurgiu"); cities.Add("Targu Jiu"); cities.Add("Miercurea Ciuc"); cities.Add("Deva"); cities.Add("Slobozia"); cities.Add("Iasi"); cities.Add("Bucuresti"); cities.Add("Baia-Mare"); cities.Add("Drobeta Turnu-Severin"); cities.Add("Targu Mures"); cities.Add("Piatra Neamt"); cities.Add("Slatina"); cities.Add("Ploiesti"); cities.Add("Zalau"); cities.Add("Satu-Mare"); cities.Add("Sibiu"); cities.Add("Suceava"); cities.Add("Alexandria"); cities.Add("Timisoara"); cities.Add("Tulcea"); cities.Add("Ramnicu Valcea"); cities.Add("Vaslui"); AddCustomerInformation.Request contact = (AddCustomerInformation.Request)validationContext.ObjectInstance; string city = contact.City; if (!cities.Contains(city)) { return(new ValidationResult("Please insert nearest County Residence")); } return(ValidationResult.Success); }
public IActionResult AddCustomerInformation( AddCustomerInformation.Request customerInformation, [FromServices] AddCustomerInformation addCustomerInformation) { if (ModelState.IsValid) { addCustomerInformation.Do(customerInformation); return(Ok()); } return(BadRequest()); }