public BrandBusiness(DatabaseFactory df = null, UnitOfWork uow = null) { DatabaseFactory dfactory = df == null ? new DatabaseFactory() : df; _unitOfWork = uow == null ? new UnitOfWork(dfactory) : uow; _brandRepository = new BrandRepository(dfactory); this._formsAuthenticationFactory = new FormsAuthenticationFactory(); }
public ConfigController() { brandRepository = new BrandRepository(); categoryRepository = new CategoryRepository(); productRepository = new ProductRepository(); customerRepository = new CustomerRepository(); shoppingCartRepository = new ShoppingCartRepository(); shoppingCartProductRepository = new ShoppingCartProductRepository(); }
public IActionResult Edit(DepotModel obj) { ViewData["UserNameM"] = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname"); ViewData["department"] = HttpContext.Session.GetString("department"); if (ModelState.IsValid) { DepotModel before = DepotRepository.FindByID((int)obj.Id); int difference = obj.totalcount - before.totalcount; obj.notusecount = before.notusecount + difference; obj.inusecount = before.inusecount; DepotRepository.Update(obj); return(RedirectToAction("Index")); } AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration); System.Collections.Generic.IEnumerable <AssetTypeModel> assets = assetTypeRepository.FindAll(); List <SelectListItem> temp = new List <SelectListItem> { }; temp.Add(new SelectListItem { Text = "Yok", Value = "" + 0 }); foreach (AssetTypeModel item in assets) { temp.Add(new SelectListItem { Text = item.name, Value = "" + item.Id }); } ViewBag.types = temp; BrandRepository brandRepository = new BrandRepository(configuration); System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll(); List <SelectListItem> tempBrands = new List <SelectListItem> { }; tempBrands.Add(new SelectListItem { Text = "Yok", Value = "" + 0 }); foreach (BrandModel item in brands) { tempBrands.Add(new SelectListItem { Text = item.name, Value = "" + item.Id }); } ViewBag.brands = tempBrands; return(View(obj)); }
public List <BrandMonitorCategory> GetBrandMonitorList() { try { IBrand ibrand = new BrandRepository(); return(ibrand.GetBrandMonitorList()); } catch (Exception ex) { throw ex; } }
public List <BrandSubCategoryModel> GetBrandSubCategoryList() { try { IBrand ibrand = new BrandRepository(); return(ibrand.GetBrandSubCategoryList()); } catch (Exception ex) { throw ex; } }
public static BrandEntity GetBrandById(long bid) { BrandEntity result = new BrandEntity(); BrandRepository mr = new BrandRepository(); BrandInfo info = mr.GetBrandByKey(bid); result = TranslateBrandEntity(info); return(result); }
public ProductService() { context = new OnlineStoreMVCEntities(); db = new ProductRepository(context); brandRepository = new BrandRepository(context); imageRepository = new Repository <share_Images>(context); categoryRepository = new CategoryRepository(context); productGroupRepository = new ProductGroupRepository(context); }
// GET: /Depot/Edit/1 public IActionResult Edit(int?id) { AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration); System.Collections.Generic.IEnumerable <AssetTypeModel> assets = assetTypeRepository.FindAll(); List <SelectListItem> temp = new List <SelectListItem> { }; temp.Add(new SelectListItem { Text = "Yok", Value = "" + 0 }); foreach (AssetTypeModel item in assets) { temp.Add(new SelectListItem { Text = item.name, Value = "" + item.Id }); } ViewBag.types = temp; BrandRepository brandRepository = new BrandRepository(configuration); System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll(); List <SelectListItem> tempBrands = new List <SelectListItem> { }; tempBrands.Add(new SelectListItem { Text = "Yok", Value = "" + 0 }); foreach (BrandModel item in brands) { tempBrands.Add(new SelectListItem { Text = item.name, Value = "" + item.Id }); } ViewBag.brands = tempBrands; ViewData["UserNameM"] = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname"); ViewData["department"] = HttpContext.Session.GetString("department"); if (id == null) { return(NotFound()); } DepotModel obj = DepotRepository.FindByID(id.Value); if (obj == null) { return(NotFound()); } return(View(obj)); }
public List <BrandSubCategoryModel> EditBrandSubCategorById(long id) { //var list = new List<BrandMonitorSubCategory>(); try { IBrand ibrand = new BrandRepository(); return(ibrand.EditBrandSubCategorById(id)); } catch (Exception ex) { throw ex; } }
public BrandShop EditBrandShopListById(long id) { //var list = new List<BrandShop>(); try { IBrand ibrand = new BrandRepository(); return(ibrand.EditBrandShopListById(id)); } catch (Exception ex) { throw ex; } }
public UnitOfWork(ApplicationDbContext dbContext) { _context = dbContext; FieldForces = new FieldForceRepository(dbContext); Brands = new BrandRepository(dbContext); Products = new ProductRepository(dbContext); MarketHierarchies = new MarketHierarchyRepository(dbContext); Distributors = new DistributorRepository(dbContext); }
public ProductsController(IMapper mapper, ProductRepository productRepository, CategoryRepository categoryRepository, BrandRepository brandRepository, PriceHistoryRepository priceHistoryRepository) { _mapper = mapper; _productRepository = productRepository; _categoryRepository = categoryRepository; _brandRepository = brandRepository; _priceHistoryRepository = priceHistoryRepository; }
public ActionResult Edit(int id) { BrandRepository repository = new BrandRepository(); ViewBag.Brand = new SelectList(repository.ViewBrand(), "BrandID", "BrandName"); Mobile editMobile = mobileBL.Edit(id); return(View(editMobile)); }
public async Task Brand_inserted_to_database() { Brand brand = await CreateValidBrand(); var repository = new BrandRepository(fixture.context); var sut = await repository.LoadAsync(brand.Id); Assert.True(await repository.ExistsAsync(sut.Id)); Assert.True(sut.Name.Length > 0); }
public BrandController GetController() { var brandRepository = new BrandRepository(); _controller = new BrandController(new BrandService(brandRepository), brandRepository); _controller.Request = new HttpRequestMessage(); _controller.Request.SetConfiguration(new HttpConfiguration()); return(_controller); }
public ActionResult Create() { CategoryRepository categoryList = new CategoryRepository(); ViewData["categories"] = categoryList.GetAll(); BrandRepository brandList = new BrandRepository(); ViewData["brands"] = brandList.GetAll(); return(View()); }
public BrandRepositoryUnitTests() { _brandRepository = new BrandRepository(DbContext); DbContext.Brands.Add(new Brand { Name = "Intel" }); DbContext.Brands.Add(new Brand { Name = "AMD" }); DbContext.SaveChanges(); }
public static List <Brand> GetBrands(bool v) { List <Brand> b; using (CustomClearviewEntities ctx = new CustomClearviewEntities()) { BrandRepository repo = new BrandRepository(ctx); b = repo.All(); } return(b); }
public WatchBusiness(BrandRepository brandRepository, WatchRepository watchRepository, WatchBookmarkRepository bookmarkRepository, StoreRepository storeRepository, SellerRepository sellerRepository, SuggestPriceRepository suggestPriceRepository, UserRepository userRepository, UnitOfWork unitOfWork) { this.watchRepository = watchRepository; this.bookmarkRepository = bookmarkRepository; this.brandRepository = brandRepository; this.unitOfWork = unitOfWork; this.storeRepository = storeRepository; this.sellerRepository = sellerRepository; this.suggestPriceRepository = suggestPriceRepository; this.userRepository = userRepository; }
public SupplierController GetController() { var supplierRepository = new SupplierRepository(); var brandRepository = new BrandRepository(); _controller = new SupplierController(supplierRepository, brandRepository); _controller.Request = new HttpRequestMessage(); _controller.Request.SetConfiguration(new HttpConfiguration()); return(_controller); }
// // GET: /Brands/ public ActionResult Index(int storeId = 0, String search = "") { var resultList = new List <Brand>(); storeId = GetStoreId(storeId); if (storeId != 0) { resultList = BrandRepository.GetBrandsByStoreId(storeId, search); } return(View(resultList)); }
public System.Data.DataTable GetBrand(int page, int rows, string BrandCode, string BrandName, string IsActive) { IQueryable <Brand> brandQuery = BrandRepository.GetQueryable(); var brand = brandQuery.Where(b => b.BrandCode.Contains(BrandCode) && b.BrandName.Contains(BrandName)) .OrderBy(b => b.BrandCode).AsEnumerable() .Select(b => new { b.BrandCode, b.UniformCode, b.CustomCode, b.BrandName, b.SupplierCode, IsActive = b.IsActive == "1" ? "可用" : "不可用", UpdateTime = b.UpdateTime.ToString("yyyy-MM-dd hh:mm:ss") }); if (!IsActive.Equals("")) { brand = brandQuery.Where(b => b.BrandCode.Contains(BrandCode) && b.BrandName.Contains(BrandName) && b.IsActive.Contains(IsActive)) .OrderBy(b => b.BrandCode).AsEnumerable() .Select(b => new { b.BrandCode, b.UniformCode, b.CustomCode, b.BrandName, b.SupplierCode, IsActive = b.IsActive == "1" ? "可用" : "不可用", UpdateTime = b.UpdateTime.ToString("yyyy-MM-dd hh:mm:ss") }); } System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.Add("统一编码", typeof(string)); dt.Columns.Add("自定义编码", typeof(string)); dt.Columns.Add("品牌名称", typeof(string)); dt.Columns.Add("厂商编码", typeof(string)); dt.Columns.Add("是否可用", typeof(string)); dt.Columns.Add("更新时间", typeof(string)); foreach (var item in brand) { dt.Rows.Add ( item.UniformCode, item.CustomCode, item.BrandName, item.SupplierCode, item.IsActive, item.UpdateTime ); } return(dt); }
public ActionResult Edit(int id) { BrandRepository repository = new BrandRepository(); IEnumerable <Entity.Brand> brand = repository.ViewBrand(); ViewBag.Brand = new SelectList(brand, "BrandID", "BrandName"); Mobile editMobile = mobileBL.Edit(id); AddMobiles addMobile = AutoMapper.Mapper.Map <Mobile, AddMobiles>(editMobile); return(View(addMobile)); }
public UnitOfWork(ApplicationDbContext dbContext) { _dbContext = dbContext; CategoryRepository = new CategoryRepository(_dbContext); BrandRepository = new BrandRepository(_dbContext); CommentRepository = new CommentRepository(_dbContext); MemberProductFavouriteRepository = new MemberProductFavouriteRepository(_dbContext); OrderProductDetailRepository = new OrderProductDetailRepository(_dbContext); OrderRepository = new OrderRepository(_dbContext); ProductImageRepository = new ProductImageRepository(_dbContext); ProductRepository = new ProductRepository(_dbContext); TemporaryItemsRepository = new TemporaryItemsRepository(_dbContext); }
public BrandForm(int id = 0) { InitializeComponent(); namePictureBox.Visible = false; if (id != 0) { this.id = id; Brand brand = BrandRepository.Get(id); brandTextBox.Text = brand.Name; } }
public IHttpActionResult TopBrandDetails() { ProductRepository product = new ProductRepository(); DefaultViewModel productInfo = new DefaultViewModel(); productInfo = product.ProductInfoForTopBrand(); BrandRepository brandDetails = new BrandRepository(); Brand brand = brandDetails.BrandDetails(productInfo.Id); return(Ok(brand)); }
public BrandsControllerTests() { // Setup var options = new DbContextOptionsBuilder <DatabaseContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var dbContext = new DatabaseContext(options); _brandRepository = new BrandRepository(dbContext); _brandRepository.Create(new Brand { Name = "Test" }); }
public ActionResult EditBrand(BrandsViewModel model) { BrandRepository repo = new BrandRepository(); Brand brand = repo.GetByID(model.ID); if (brand == null) { brand = new Brand(); } brand.Name = model.Name; brand.CountryOfOrigin = model.CountryOfOrigin; repo.Save(brand); return(RedirectToAction("Edit")); }
public object GetDetails(int page, int rows, string BrandCode, string BrandName, string IsActive) { IQueryable <Brand> brandQuery = BrandRepository.GetQueryable(); var brand = brandQuery.Where(b => b.BrandCode.Contains(BrandCode) && b.BrandName.Contains(BrandName)).OrderBy(b => b.BrandCode).AsEnumerable().Select(b => new { b.BrandCode, b.UniformCode, b.CustomCode, b.BrandName, b.SupplierCode, IsActive = b.IsActive == "1" ? "可用" : "不可用", UpdateTime = b.UpdateTime.ToString("yyyy-MM-dd hh:mm:ss") }); if (!IsActive.Equals("")) { brand = brandQuery.Where(b => b.BrandCode.Contains(BrandCode) && b.BrandName.Contains(BrandName) && b.IsActive.Contains(IsActive)).OrderBy(b => b.BrandCode).AsEnumerable().Select(b => new { b.BrandCode, b.UniformCode, b.CustomCode, b.BrandName, b.SupplierCode, IsActive = b.IsActive == "1" ? "可用" : "不可用", UpdateTime = b.UpdateTime.ToString("yyyy-MM-dd hh:mm:ss") }); } int total = brand.Count(); brand = brand.Skip((page - 1) * rows).Take(rows); return(new { total, rows = brand.ToArray() }); }
public bool Save(Brand brand) { var br = BrandRepository.GetQueryable().FirstOrDefault(b => b.BrandCode == brand.BrandCode); br.UniformCode = brand.UniformCode; br.CustomCode = brand.CustomCode; br.BrandName = brand.BrandName; br.SupplierCode = brand.SupplierCode; br.IsActive = brand.IsActive; br.UpdateTime = DateTime.Now; BrandRepository.SaveChanges(); return(true); }
public UnitOfWork() { _context.Configuration.LazyLoadingEnabled = true; Brand = new BrandRepository(_context); Category = new CategoryRepository(_context); Customer = new CustomerRepository(_context); CustomerAddress = new CustomerAddressRepository(_context); File = new FileRepository(_context); Product = new ProductRepository(_context); Promotion = new PromotionRepository(_context); ProductParent = new ProductParentRepository(_context); Provider = new ProviderRepository(_context); }
public void Should() { _repository = new BrandRepository(ObjectFactory.GetInstance<ISessionFactory>()); BeInstantiated(); BeAbleToUseTypedSessionQuery(); BeAbleGiveACountOfZeroWhenNothingSaved(); NotThrowAnErrorWhenAddingANewBrand(); AfterSaveReturnACountOfOne(); BeAbleToFindTheNewBrand(); TheFoundBrandShouldReferenceTheSameObject(); ReturnTrueForContainsBrand(); ReturnFalseForAnotherBrand(); ReturnsTrueForNewBrandWithTheSameName(); CanRemoveTheInsertedBrand(); }