public BusinessService(UserAddressRepository userAddressRepo, OrderRepository orderRepo, BusinessRepository businessRepo, ApplicationUserManager userMan) { _userAddressRepo = userAddressRepo; _orderRepo = orderRepo; _businessRepo = businessRepo; _userManager = userMan; }
//public CustomerService(OrderRepository orderRepo, ApplicationUserManager userMan) public CustomerService(UserAddressRepository userAddressRepo, OrderRepository orderRepo, CustomerRepository customerRepo, ApplicationUserManager userMan) { _userAddressRepo = userAddressRepo; _orderRepo = orderRepo; _customerRepo = customerRepo; _userManager = userMan; }
public ShopProductController(ShopProductRepository shopProductRepository , IConfiguration configuration , ProductRepostitory productRepostitory , ProductPackageDetailsRepostitory productPackageDetailsRepostitory , ShopOrderRepository shopOrderRepository , ManageBankService manageBankService , UsersPaymentRepository usersPaymentRepository , UserAddressRepository userAddressRepository , UserRepository userRepository , ShopOrderPaymentRepository shopOrderPaymentRepository , ProductUnitRepository productUnitRepository , LogRepository logRepository , WarehouseProductCheckRepository warehouseProductCheckRepository , SmsRestClient smsRestClient , OstanRepository ostanRepository) { _bankConfig = configuration.GetSection(nameof(BankConfig)).Get <BankConfig>(); _shopProductRepository = shopProductRepository; _configuration = configuration; _productRepostitory = productRepostitory; _productPackageDetailsRepostitory = productPackageDetailsRepostitory; _shopOrderRepository = shopOrderRepository; _manageBankService = manageBankService; _usersPaymentRepository = usersPaymentRepository; _userAddressRepository = userAddressRepository; _userRepository = userRepository; _shopOrderPaymentRepository = shopOrderPaymentRepository; _productUnitRepository = productUnitRepository; _logRepository = logRepository; _warehouseProductCheckRepository = warehouseProductCheckRepository; _smsRestClient = smsRestClient; _ostanRepository = ostanRepository; }
public static void Delete(Guid userID) { // first check if we have the right to delete that user - authorization UserAddressRepository.Delete(userID); UserRepository.Delete(userID); }
public UserAddressRepositoryTest() { DbContextInMemory = GetInMemoryDbContext(); MappingConfig = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingsProfile()); }); Mapper = MappingConfig.CreateMapper(); LoggerMock = new Mock <ILogger <UserAddressRepository> >(); UserAddressRepositoryUnderTest = new UserAddressRepository(DbContextInMemory, Mapper, LoggerMock.Object); }
public UnitOfWork(ApplicationDbContext contex) { _contex = contex; Categories = new CategoryRepository(_contex); Orders = new OrderRepository(_contex); Products = new ProductRepository(_contex); CartItems = new CartRepository(_contex); UserAddress = new UserAddressRepository(_contex); }
public ActionResult AddressRemove(string id) { if (id != null) { var uar = new UserAddressRepository(); uar.Delete(id); return(RedirectToAction("Index")); } return(View("Error")); }
public ShopOrderRepository(DatabaseContext dbContext , UserAddressRepository userAddressRepository , ShopProductRepository shopProductRepository , IDbConnection connection , WarehouseProductCheckRepository warehouseProductCheckRepository) : base(dbContext) { _userAddressRepository = userAddressRepository; _shopProductRepository = shopProductRepository; _connection = connection; _warehouseProductCheckRepository = warehouseProductCheckRepository; }
public ActionResult NewOrderAddress(UserAddress model, string selectedShipper) { ViewData["SelectedShipper"] = selectedShipper; if (ModelState.IsValid) { var user = userManager.FindByName(User.Identity.Name); model.UserId = user.Id; var uar = new UserAddressRepository(); uar.AddOrUpdate(model); } return(RedirectToAction("OrderAddress", new { selectedShipper = selectedShipper })); }
public UserOrderController(ShopOrderRepository shopOrderRepository , ShopProductRepository shopProductRepository , UserRepository userRepository , UserAddressRepository userAddressRepository , ShopOrderPaymentRepository shopOrderPaymentRepository) { _shopOrderRepository = shopOrderRepository; _shopProductRepository = shopProductRepository; _userRepository = userRepository; _userAddressRepository = userAddressRepository; _shopOrderPaymentRepository = shopOrderPaymentRepository; }
public UnitOfWork(OnlineStoreContext context) { _context = context; UserAddress = new UserAddressRepository(_context); Products = new ProductRepository(_context); Orders = new OrderRepository(_context); OrderItems = new OrderItemRepository(_context); ShoppingCarts = new ShoppingCartRepository(_context); ShoppingCartItems = new ShoppingCartItemRepository(_context); }
public BaseWorkArea(CoreDbContext context) : base(context) { User = new UserRepository(context); Permission = new PermissionRepository(context); UserAddress = new UserAddressRepository(context); Media = new MediaRespository(context); DataItem = new DataItemRepository(context); Setting = new SettingRepository(context); UrlSlug = new UrlSlugRepository(context); District = new DistrictRepository(context); SiteSettings = new SiteSettingsRepository(context); SiteHost = new SiteHostRepository(context); }
public BaseWorkArea(CoreDbContext context) : base(context) { User = new UserRepository(context); Permission = new PermissionRepository(context); RolePermission = new BaseRepository <RolePermissionEntity>(context); RoleModule = new BaseRepository <RoleModuleEntity>(context); UserAddress = new UserAddressRepository(context); Media = new MediaRespository(context); Setting = new SettingRepository(context); UrlSlug = new UrlSlugRepository(context); District = new DistrictRepository(context); SiteSettings = new SiteSettingsRepository(context); SiteHost = new SiteHostRepository(context); }
public async void Should_return_nullexception_when_address_is_null() { // Arrange Address address = null; int userId = 1; var DbContextInMemory = GetInMemoryDbContext(); var LoggerMock = new Mock <ILogger <UserAddressRepository> >(); var UserAddressRepositoryUnderTest = new UserAddressRepository(DbContextInMemory, Mapper, LoggerMock.Object); //Act var result = UserAddressRepositoryUnderTest.CreateAsync(userId, address); //Assert await Assert.ThrowsAsync <ArgumentNullException>(async() => await result); }
public ActionResult GetAll() { try { IEnumerable <User> users = UserRepository.GetAll(); IEnumerable <UserAddress> addresses = UserAddressRepository.GetAll(); return(View(Models.UserFacade.Build(users, addresses))); } // catch(BusinessLayer.AuthorizationException) // display authorization response catch (Exception e) { // Should return an exception relative result if the user needs to know about it. // Otherwise, just log the exception. return(View()); } }
public ProfileController(UserRepository userRepository , ShopOrderRepository shopOrderRepository , ShopProductRepository shopProductRepository , UserAddressRepository userAddressRepository , ProductUnitRepository productUnitRepository , TreeRepository treeRepository , ProductRepostitory productRepostitory , ShopOrderPaymentRepository shopOrderPaymentRepository) { _userRepository = userRepository; _shopOrderRepository = shopOrderRepository; _shopProductRepository = shopProductRepository; _userAddressRepository = userAddressRepository; _productUnitRepository = productUnitRepository; _treeRepository = treeRepository; _productRepostitory = productRepostitory; _shopOrderPaymentRepository = shopOrderPaymentRepository; }
public ActionResult AddToOrderAddress(string id, string shipper) { var uar = new UserAddressRepository(); var address = uar.SelectById(id); if (id == null || address == null) { return(RedirectToAction("OrderAddress")); } if ((Order)Session["Order"] == null) { return(RedirectToAction("TimeOut")); } var order = (Order)Session["Order"]; order.UserAddress = address; order.ShippingId = shipper; Session["Order"] = order; return(RedirectToAction("Payment")); }
public async void Should_return_Address_when_userId_exist() { // Arrange var userId = 1; var userEntity = UserAddressDataEntity; var DbContextInMemory = GetInMemoryDbContext(); var LoggerMock = new Mock <ILogger <UserAddressRepository> >(); var UserAddressRepositoryUnderTest = new UserAddressRepository(DbContextInMemory, Mapper, LoggerMock.Object); //Act var result = await UserAddressRepositoryUnderTest.ReadAsync(userId); //Assert Assert.Equal(userEntity.Address.Address1, GetValue("Address1")); Assert.Equal(userEntity.Address.Address2, GetValue("Address2")); object GetValue(string Name) { return(result[0].GetType().GetProperty(Name).GetValue(result[0])); } }
public ManageOrdersController(ShopOrderRepository shopOrderRepository , UsersPaymentRepository usersPaymentRepository , ShopProductRepository shopProductRepository , UsersAccessRepository usersAccessRepository , ShopOrderDetailsRepository shopOrderDetailsRepository , UserRepository userRepository , UserAddressRepository userAddressRepository, ShopOrderStatusRepository shopOrderStatusRepository, SmsRestClient smsRestClient, ProductUnitRepository productUnitRepository, ShopOrderPaymentRepository shopOrderPaymentRepository) : base(usersAccessRepository) { _shopOrderRepository = shopOrderRepository; _usersPaymentRepository = usersPaymentRepository; _shopProductRepository = shopProductRepository; _shopOrderDetailsRepository = shopOrderDetailsRepository; _userRepository = userRepository; _userAddressRepository = userAddressRepository; _shopOrderStatusRepository = shopOrderStatusRepository; _smsRestClient = smsRestClient; _productUnitRepository = productUnitRepository; _shopOrderPaymentRepository = shopOrderPaymentRepository; }
public async void Should_return_object_when_address_created() { int userId = 1; var DbContextInMemory = GetInMemoryDbContext(); var LoggerMock = new Mock <ILogger <UserAddressRepository> >(); var UserAddressRepositoryUnderTest = new UserAddressRepository(DbContextInMemory, Mapper, LoggerMock.Object); Address address = UserDataEntity; var resultObject = new Address { Address1 = "1601 Hood Avenue", Address2 = "dolore in adipisicing et", City = "San Diego", CountryCode = "11", PinCode = "92103", StateId = 1, IsVerified = false }; //Act var result = await UserAddressRepositoryUnderTest.CreateAsync(userId, address); //Assert Assert.Equal(resultObject.Address1, GetValue("Address1")); Assert.Equal(resultObject.Address2, GetValue("Address2")); Assert.Equal(resultObject.City, GetValue("City")); Assert.Equal(resultObject.CountryCode, GetValue("CountryCode")); Assert.Equal(resultObject.PinCode, GetValue("PinCode")); Assert.Equal(resultObject.StateId, GetValue("StateId")); Assert.Equal(resultObject.IsVerified, GetValue("IsVerified")); object GetValue(string Name) { return(result.GetType().GetProperty(Name).GetValue(result)); } }
public MemberApiController(UserRepository userRepo, MacAddressRepository macAddressRepo, UserAddressRepository userAddressRepo, ApiAccessUserSessionRepository apiUserSessionRepo) { UserRepository = userRepo; MacAddressRepository = macAddressRepo; ApiUserSessionRepository = apiUserSessionRepo; }
public AccountApiController(UserRepository userRepo, MacAddressRepository macAddressRepo, UserAddressRepository userAddressRepo) { UserRepository = userRepo; MacAddressRepository = macAddressRepo; }
protected override void Seed(ApplicationDbContext context) { var userAddresses = new UserAddress[] { new UserAddress { Id = 1, FirstName = "John", LastName = "Smith", Phone = "555-444-3156", AddressLine1 = "1234 Broadway St", AddressLine2 = "", City = "Spring", State = "Texas", Zipcode = 77386 }, new UserAddress { Id = 2, FirstName = "Adam", LastName = "Berger", Phone = "111-666-2458", AddressLine1 = "6545 Merak St", AddressLine2 = "", City = "Conroe", State = "Texas", Zipcode = 77301 }, new UserAddress { Id = 3, FirstName = "Nick", LastName = "Fersman", Phone = "455-678-7772", AddressLine1 = "3156 Palm St", AddressLine2 = "", City = "Katy", State = "Texas", Zipcode = 77449 }, new UserAddress { Id = 4, FirstName = "Bob", LastName = "Shulz", Phone = "345-233-6768", AddressLine1 = "7899 Main St", AddressLine2 = "", City = "Pasadena", State = "Texas", Zipcode = 77501 }, new UserAddress { Id = 5, FirstName = "Greg", LastName = "Stein", Phone = "655-112-3444", AddressLine1 = "7860 Main St", AddressLine2 = "", City = "Pasadena", State = "Texas", Zipcode = 77501 }, new UserAddress { Id = 6, FirstName = "Edward", LastName = "Brigg", Phone = "112-322-6644", AddressLine1 = "3345 Mapple St", AddressLine2 = "", City = "Katy", State = "Texas", Zipcode = 77449 }, new UserAddress { Id = 7, FirstName = "Mark", LastName = "Carpenter", Phone = "789-456-1233", AddressLine1 = "4455 Pine St", AddressLine2 = "", City = "Spring", State = "Texas", Zipcode = 77386 }, new UserAddress { Id = 8, FirstName = "Rick", LastName = "White", Phone = "333-124-3566", AddressLine1 = "3311 Hollow St", AddressLine2 = "", City = "Conroe", State = "Texas", Zipcode = 77501 } }; var orders = new Order[] { new Order { Id = 1, ServiceName = "Electricity", OrderDate = new DateTime(2015, 11, 26, 10, 30, 0), CompletionDate = new DateTime(2015, 11, 28, 12, 30, 0), Price = 84.53m, ServiceQuality = 4, IsApproved = false, IsCompleted = false }, new Order { Id = 2, ServiceName = "Plumbing", OrderDate = new DateTime(2015, 10, 26, 09, 17, 54), CompletionDate = new DateTime(2015, 10, 26, 17, 10, 44), Price = 112.31m, ServiceQuality = 5, IsApproved = false, IsCompleted = false }, new Order { Id = 3, ServiceName = "Pool", OrderDate = new DateTime(2015, 12, 04, 09, 11, 32), CompletionDate = new DateTime(2015, 12, 05, 16, 22, 37), Price = 874.22m, ServiceQuality = 4, IsApproved = false, IsCompleted = false }, new Order { Id = 4, ServiceName = "Roof", OrderDate = new DateTime(2015, 11, 09, 09, 07, 32), CompletionDate = new DateTime(2015, 12, 04, 17, 55, 21), Price = 1245.14m, ServiceQuality = 3, IsApproved = false, IsCompleted = false }, new Order { Id = 5, ServiceName = "Replace Electric Wire", OrderDate = new DateTime(2015, 12, 09, 08, 12, 46), CompletionDate = new DateTime(2015, 12, 12, 17, 33, 07), Price = 68.47m, ServiceQuality = 4, IsApproved = false, IsCompleted = false } }; context.UserAddresses.AddOrUpdate(a => a.Id, userAddresses); context.Orders.AddOrUpdate(o => o.Id, orders); CustomerRepository customerRepo = new CustomerRepository(context); var john = customerRepo.FindByCustomerEmail("*****@*****.**"); if (john == null) { john = new CustomerUser() { UserName = "******", Email = "*****@*****.**" }; customerRepo.Add(john, "Password!1"); } var adam = customerRepo.FindByCustomerEmail("*****@*****.**"); if (adam == null) { adam = new CustomerUser() { UserName = "******", Email = "*****@*****.**" }; customerRepo.Add(adam, "Password!2"); } var fersman = customerRepo.FindByCustomerEmail("*****@*****.**"); if (fersman == null) { fersman = new CustomerUser() { UserName = "******", Email = "*****@*****.**" }; customerRepo.Add(fersman, "Password!3"); } var bob = customerRepo.FindByCustomerEmail("*****@*****.**"); if (bob == null) { bob = new CustomerUser() { UserName = "******", Email = "*****@*****.**" }; customerRepo.Add(bob, "Password!4"); } BusinessRepository businessRepo = new BusinessRepository(context); var greg = businessRepo.FindByBusinessEmail("*****@*****.**"); if (greg == null) { greg = new BusinessUser() { UserName = "******", Email = "*****@*****.**", CompanyName = "Stein Plumbing", ServiceCategory = "Plumbing", Description = "Residential and business plumbing" }; businessRepo.Add(greg, "Password!11"); } var edward = businessRepo.FindByBusinessEmail("*****@*****.**"); if (edward == null) { edward = new BusinessUser() { UserName = "******", Email = "*****@*****.**", CompanyName = "Brigg Electricity", ServiceCategory = "Electricity", Description = "All kinds of electric repairs" }; businessRepo.Add(edward, "Password!12"); } var mark = businessRepo.FindByBusinessEmail("*****@*****.**"); if (mark == null) { mark = new BusinessUser() { UserName = "******", Email = "*****@*****.**", CompanyName = "Blue Pools", ServiceCategory = "Pool", Description = "New pools and repair, rennovation" }; businessRepo.Add(mark, "Password!13"); } var rick = businessRepo.FindByBusinessEmail("*****@*****.**"); if (rick == null) { rick = new BusinessUser() { UserName = "******", Email = "*****@*****.**", CompanyName = "White Roofing", ServiceCategory = "Roof", Description = "Roof rennovation and repairs" }; businessRepo.Add(rick, "Password!14"); } UserAddressRepository addressRepo = new UserAddressRepository(context); var address1 = addressRepo.FindById(1, null); var address2 = addressRepo.FindById(2, null); var address3 = addressRepo.FindById(3, null); var address4 = addressRepo.FindById(4, null); var address11 = addressRepo.FindById(5, null); var address12 = addressRepo.FindById(6, null); var address13 = addressRepo.FindById(7, null); var address14 = addressRepo.FindById(8, null); address1.User = john; address2.User = adam; address3.User = fersman; address4.User = bob; address11.User = greg; address12.User = edward; address13.User = mark; address14.User = rick; OrderRepository orderRepo = new OrderRepository(context); var order1 = orderRepo.FindById(1, null); var order2 = orderRepo.FindById(2, null); var order3 = orderRepo.FindById(3, null); var order4 = orderRepo.FindById(4, null); var order5 = orderRepo.FindById(5, null); order1.Business = edward; order1.Customer = fersman; order2.Business = greg; order2.Customer = bob; order3.Business = mark; order3.Customer = adam; order4.Business = rick; order4.Customer = john; order5.Business = edward; order5.Customer = john; context.SaveChanges(); }
public ApplicationUserService(UserAddressRepository userAddressRepo, DbContext context) { _userAddressRepo = userAddressRepo; _userManager = new ApplicationUserManager(new UserStore <ApplicationUser>(context)); }
public UserAddressServices(UserAddressRepository repo) { _repo = repo; }
public ApplicationUserService(UserAddressRepository userAddressRepo, DbContext context) { _userAddressRepo = userAddressRepo; _userManager = new ApplicationUserManager(new UserStore<ApplicationUser>(context)); }