public void InsertThenUpdate_ShouldReflectChanges() { // Arrange var expectedValue = "*****@*****.**"; var dummyString = Guid.NewGuid().ToString().Replace("-", ""); var dbModel = new SubCategoryModel() { Description = dummyString, }; // Act var newId = new SubCategoryRepository(AppState.ConnectionString) .Insert(dbModel); var dbModel2 = new SubCategoryRepository(AppState.ConnectionString) .Select(newId); dbModel2.Description = expectedValue; new SubCategoryRepository(AppState.ConnectionString) .Update(dbModel2); var actualValue = new SubCategoryRepository(AppState.ConnectionString) .Select(newId) .Description; // Assert Assert.AreEqual(expectedValue, actualValue); }
public void InsertBulkThenSelectList_ShouldEqualTwo() { // Arrange var expectedValue = 2; var dummyString = Guid.NewGuid().ToString().Replace("-", ""); var listPoco = new List <SubCategoryModel>() { new SubCategoryModel() { Description = dummyString, }, new SubCategoryModel() { Description = dummyString, } }; // Act new SubCategoryRepository(AppState.ConnectionString).InsertBulk(listPoco); var actualValue = new SubCategoryRepository(AppState.ConnectionString) .SelectList() .Where(x => x.Description.Equals(dummyString)) .ToList() .Count; // Assert Assert.AreEqual(expectedValue, actualValue); }
public SubCategoryBusiness(DatabaseFactory df = null, UnitOfWork uow = null) { DatabaseFactory dfactory = df == null ? new DatabaseFactory() : df; _unitOfWork = uow == null ? new UnitOfWork(dfactory) : uow; _subcategoryRepository = new SubCategoryRepository(dfactory); }
public ProdeuctModelManager() { _generalCategoryRepository = new GeneralCategoryRepository(); _categoryRepository = new CategoryRepository(); _subCategoryRepository = new SubCategoryRepository(); _productModelRepository = new ProductModelRepository(); }
public UnitOfWork(DataContext context) { _context = context; Categories = new CategoryRepository(context); SubCategories = new SubCategoryRepository(context); Items = new ItemRepository(context); }
public SubCategorysController(ILogger <SubCategorysController> logger, SubCategoryRepository subCategoryRepository, IConfiguration configuration) { _logger = logger; _subCategoryRepository = subCategoryRepository; _configuration = configuration; }
public IActionResult Update(int id) { var list = new SubCategoryRepository().GetUISubCategories(); ViewBag.SubCategorys = list; return(View("AddOrUpdate", repository.GetByColumName("Id", id).FirstOrDefault())); }
public void SetUp() { _dbContextOptions = new DbContextOptionsBuilder <DueltankDbContext>() .UseInMemoryDatabase("dueltank") .Options; _sut = new SubCategoryRepository(new DueltankDbContext(_dbContextOptions)); }
public UnitOfWork(HierarichyContext context) { _context = context; DepartmentRepository = new DepartmentRepository(context); CategoryRepository = new CategoryRepository(context); SubCategoryRepository = new SubCategoryRepository(context); LocationRepository = new LocationRepository(context); }
public UnitOfWork() { _dbContext = new MyContext(); User = new UserRepository(_dbContext); Product = new ProductRepository(_dbContext); Category = new CategoryRepository(_dbContext); SubCategory = new SubCategoryRepository(_dbContext); WishList = new WishListRepository(_dbContext); }
public void TestSubCategoryConnection() { _subrepo = new SubCategoryRepository(new BzaleDatabaseContext()); var category = _subrepo.GetSubCategoriesByMainID(30, 1, int.MaxValue); Assert.IsNotNull(category); }
public TodoAppDbContext(DbContextOptions options) : base(options) { context = this; CategoryRepository = new CategoryRepository(context); SubCategoryRepository = new SubCategoryRepository(context); TodoRepository = new TodoRepository(context); NoteRepository = new NoteRepository(context); LinkRepository = new LinkRepository(context); FileRepository = new FileRepository(context); }
public UnitOfWork(JooleContext context) { _context = context; Users = new UserRepository(_context); Categories = new CategoryRepository(_context); SubCategories = new SubCategoryRepository(_context); Products = new ProductRepository(_context); TechProps = new TechPropRepository(_context); TypeProps = new TypePropRepository(_context); Manufacturers = new ManufacturerRepository(_context); }
public UnitOfWork(ApplicationDbContext context) { this._context = context; Adresses = new AddressRepository(_context); Wallets = new WalletRepository(_context); Companies = new CompanyRepository(_context); Products = new ProductRepository(_context); Categories = new CategoryRepository(_context); SubCategories = new SubCategoryRepository(_context); Transactions = new TransactionRepository(_context); }
public ActionResult AdminNavbar() { MainCategoryRepository mainCategoryRepository = new MainCategoryRepository(); SubCategoryRepository subCategoryRepository = new SubCategoryRepository(); FinalSubCategoryRepository finalSubCategoryRepository = new FinalSubCategoryRepository(); CategoryViewModel categoryViewModel = new CategoryViewModel(); categoryViewModel.mainCategories = mainCategoryRepository.GetAll(); categoryViewModel.subCatetories = subCategoryRepository.GetAll(); categoryViewModel.finalSubCategories = finalSubCategoryRepository.GetAll(); return(PartialView("_AdminNavbar", categoryViewModel)); }
private void cbCategory_SelectedIndexChanged(object sender, EventArgs e) { try { SubCategoryRepository r1 = new SubCategoryRepository(); DataSet result = r1.ListForCategory((int)cbCategory.SelectedValue); cbSubCategory.DataSource = result.Tables[0]; cbSubCategory.DisplayMember = "SubCategoryName"; cbSubCategory.ValueMember = "Id"; } catch (Exception) { } }
public UnitOfWork(JooleContext Context) { this._context = Context; Users = new UserRepository(_context); Projects = new ProjectRepository(_context); Categories = new CategoryRepository(_context); SubCategories = new SubCategoryRepository(_context); //ProductList = new ProductListRepository(_context); Products = new ProductRepository(_context); ProductProperties = new ProductPropertyRepository(_context); ProductPropertyValues = new ProductPropertyValueRepository(_context); ProdToProjRelations = new ProductToProjectRepository(_context); TechSpecFilter = new TechSpecFilterRepository(_context); }
public SiteDataService(ILogger <SiteDataService> logger, IConfiguration configuration, ApplicationDbContext context, CategoryRepository categoryRepository, ServicesRepository servicesRepository, ArticlesRepository articlesRepository, PartnerRepository partnerRepository, SubCategoryRepository subCategoryRepository, IgnoresRepository ignoresRepository) { _logger = logger; _configuration = configuration; _context = context; _categoryRepository = categoryRepository; _servicesRepository = servicesRepository; _articlesRepository = articlesRepository; _partnerRepository = partnerRepository; _subCategoryRepository = subCategoryRepository; _ignoresRepository = ignoresRepository; }
public IActionResult AddProduct() { var model = new UIProductSupCategory(); var c = new SubCategoryRepository().GetAll("Id", "Name"); if (c.Count > 0) { foreach (var item in c) { model.Subcategores.Add(new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem(item.Name, item.Id.ToString())); } } return(View(model)); }
public IActionResult UpdateProduct(int id) { var pr = repository.GetByColumName("Id", id); var model = new UIProductSupCategory(); model.Product = pr.FirstOrDefault(); var c = new SubCategoryRepository().GetAll("Id", "Name"); if (c.Count > 0) { foreach (var item in c) { model.Subcategores.Add(new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem(item.Name, item.Id.ToString())); } } return(View(model)); }
public void InsertAndSelect_ShouldEqualInserted() { // Arrange var dbModel = new SubCategoryModel() { Description = "voluptatem", }; var expectedValue = new SubCategoryRepository(AppState.ConnectionString) .Insert(dbModel); // Act var actualValue = new SubCategoryRepository(AppState.ConnectionString) .Select(expectedValue) .Id; // Assert Assert.AreEqual(expectedValue, actualValue); }
public bool ChangeSubCategory(int id, int categoryId, bool value) { var subCategory = new SubCategoryRepository(); var s = subCategory.GetByColumName("Id", id).FirstOrDefault(); if (s == null) { return(false); } if (value) { s.CategoryId = categoryId; } else { s.CategoryId = 0; } return(subCategory.Update(s, id)); }
public void InsertAndDelete_ShouldNoLongerExistAfterDelete() { // Arrange var expectedValue = 0; var dbModel = new SubCategoryModel() { Description = "quibusdam", }; // Act var newId = new SubCategoryRepository(AppState.ConnectionString).Insert(dbModel); new SubCategoryRepository(AppState.ConnectionString).Delete(newId); var actualValue = new SubCategoryRepository(AppState.ConnectionString) .Select(newId) .Id; // Assert Assert.AreEqual(expectedValue, actualValue); }
public SubCategoryManager(SubCategoryRepository subCategoryRepository) { _subCategoryRepository = subCategoryRepository; }
public SubCategoryManager() { _subCategoryRepository = new SubCategoryRepository(); }
public BaseCategoryManager() { _generalCategoryRepository = new GeneralCategoryRepository(); _categoryRepository = new CategoryRepository(); _subCategoryRepository = new SubCategoryRepository(); }
public SubCategoryBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; subCategoryRepository = new SubCategoryRepository(unitOfWork); }
public SubCategoryService() { _subCategoryRepository = new SubCategoryRepository(); }
public void Setup() { Repository = new SubCategoryRepository(Context); }