Exemplo n.º 1
0
 public void AddColor(FiltersTable newColor)
 {
     using (var ctx = new bazaEntities())
     {
         ctx.FiltersTables.Add(newColor);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 2
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;
        }