public RepoControllerDirectTests(ITestOutputHelper output, ConfigurationFactory <ColorController> fixture)
        {
            _output = output;

            _repo = TestRepoFactory.CreateWriteableTemporalRepo <
                ColorRepo, Color, ColorDbContext, ColorHistoryDbContext, ColorController>(fixture);

            _ctlr = new ColorController(_repo, new Logger <ColorController>(new LoggerFactory()));
        }
Ejemplo n.º 2
0
        public static List <FiltersTable> ReturnFiltersList()
        {
            List <FiltersTable> list = ColorRepo.GetColors().ToList();

            List <string> tempList = list.Select(p => p.FilterResourceName).ToList();

            RemoveWhiteSpacesAndReplaceToGlobalResources(ref tempList);
            for (int i = 0; i < list.Count; i++)
            {
                list[i].FilterResourceName = tempList[i];
            }
            return(list);
        }
Ejemplo n.º 3
0
        public void AddNewItem()
        {
            try
            {
                string _Brand;
                if (View.DropDownDownListBrand.Visible)
                {
                    _Brand = View.TxtBoxInsertNewBrandProp.Text;
                }
                else
                {
                    _Brand = View.DropDownDownListBrand.SelectedItem.Text;
                }
                Auction currentItem = new Auction()
                {
                    Title = View.AuctionName,
                    //Category = (int)View.AuctionCategoryType,     //this is useful validator if User want to add item that category is not added but now when Categories are added dynamically it is useless
                    Category    = View.AuctionCategoryTypeInt,
                    Color       = View.AuctionColorInt,
                    Description = View.AuctionDescrition,
                    Price       = View.AuctionPrice,
                    seller      = System.Web.Security.Membership.GetUser().UserName,
                    status      = "otwarte",
                    Brand       = _Brand,
                    Image       = View.AuctionImageBytes
                };
                if (View.TxtBoxInsertNewColorProp.Visible)
                {
                    FiltersTable newColor = new FiltersTable()
                    {
                        FilterResourceName = View.TxtBoxInsertNewColorProp.Text
                    };
                    ColorRepo.AddColor(newColor);
                }
                AuctionRepo.AddAuctions(currentItem);
            }
            catch
            {
                View.ControlLabel.Visible = true;

                View.ControlLabel.Text      = "Somenthing went wrong try again lter";
                View.ControlLabel.Font.Size = 32;
            }
            ClearLabels();

            View.ControlLabel.Text      = "Congrats! Your Item was succesfully added";
            View.ControlLabel.Font.Size = 32;
        }
Ejemplo n.º 4
0
 public ColorController(ColorRepo repo, ILogger <ColorController> logger)
 {
     _repo   = repo;
     _logger = logger;
 }