public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Customer res = _customerFacade.Get(); if (res == null) { return(HttpNotFound()); } return(View(new RegisterVM { Id = res.Id, Username = res.UserName, Title = res.Title, Forename = res.Forename, Surname = res.Surname, Dob = res.DoB, AddressStreet = res.AddressStreet, AddressTown = res.AddressTown, AddressCounty = res.AddressCounty, AddressPostalCode = res.AddressPostalCode, HomePhoneNo = res.HomePhoneNo, WorkPhoneNo = res.WorkPhoneNo ?? "No number", MobilePhoneNo = res.MobilePhoneNo, Email = res.Email, })); }
private static void SetUpDatabase() { var db = new EFContext(); var customerFacade = new CustomerFacade(new CustomerRepository(db), new AddressRepository(db), null, new PasswordHandler()); var productRepository = new ProductRepository(db); var productFacade = new ProductFacade(productRepository); var auctionFacade = new AuctionFacade(new AuctionRepository(db), productRepository); var customerId = Guid.NewGuid(); customerFacade.Add(customerId, "Elin", "Danielsson", new List <Address>() { new Address { AddressType = AddressType.Home, City = "Nykvarn", Country = "Sweden", Id = Guid.NewGuid(), PostalCode = "15531", Street = "Skärarevägen 8" } }, "elin", "elin", "*****@*****.**"); var adminId = Guid.NewGuid(); customerFacade.Add(adminId, "Gunnar", "Karlsson", new List <Address>() { new Address { AddressType = AddressType.Work, City = "Stockholm", Country = "Sweden", Id = Guid.NewGuid(), PostalCode = "12345", Street = "Gatan 1" } }, "admin", "admin", "*****@*****.**"); IProductFactory prodcuFactory = new ProductFactory(); Supplier supplier = new Supplier { Id = Guid.NewGuid(), Name = "Elin" }; var product = prodcuFactory.Create(ProductType.Antique, Guid.NewGuid(), "Vas", 22, 300, supplier) as AntiqueProduct; product.TimeEpoch = TimeEpoch.Baroque; Customer customer = customerFacade.Get(customerId); IList <Bid> bids = new List <Bid> { new Bid { Amount = 400, Id = Guid.NewGuid(), Customer = customer, Time = DateTime.Now } }; Auction auction = new Auction() { AcceptedPrice = product.GetStartPrice() * (decimal)1.5, Product = product, Id = Guid.NewGuid(), Bids = bids, StartTime = DateTime.Now.AddHours(-2), EndTime = DateTime.Now.AddDays(7) }; db.Suppliers.Add(supplier); db.AntiqueProducts.Add(product); db.Bids.AddRange(bids); db.Auctions.Add(auction); }
private async Task GetValues() { _authFacade.GetToken(username, password); customer = await _customerFacade.Get(); }
private async Task GetValues() { int id = GenericFacade.UserId; Customer c = await _customerFacade.Get(); }