示例#1
0
        protected void Create_Click(object sender, EventArgs e)
        {
            if (ModelState.IsValid)
            {
                var catalogItem = new CatalogItem()
                {
                    Name                  = Name.Text,
                    Description           = Description.Text,
                    CatalogManufacturerId = int.Parse(Manufacturer.SelectedValue),
                    CatalogTypeId         = int.Parse(Type.SelectedValue),
                    Price                 = decimal.Parse(Price.Text),
                    AvailableStock        = int.Parse(Stock.Text)
                };
                var itemSpecs = new CatalogItemSpecs()
                {
                    Polyphony    = Polyphony.Text,
                    Oscillators  = Oscillators.Text,
                    Lfo          = Lfo.Text,
                    Filter       = Filter.Text,
                    Effects      = Effects.Text,
                    Keyboard     = Keyboard.Text,
                    Memory       = Memory.Text,
                    DateProduced = int.Parse(DateProduced.Text)
                };

                var specId = CatalogService.CreateCatalogItemSpecs(itemSpecs);
                catalogItem.CatalogItemSpecsId = specId;
                CatalogService.CreateCatalogItem(catalogItem);
                Response.Redirect("~");
            }
        }
示例#2
0
        public int CreateCatalogItemSpecs(CatalogItemSpecs itemSpecs)
        {
            var maxId = catalogItemSpecs.Max(i => i.Id);

            itemSpecs.Id = ++maxId;
            catalogItemSpecs.Add(itemSpecs);
            return(maxId);
        }
示例#3
0
        public void UpdateCatalogItemSpecs(CatalogItemSpecs modifiedItem)
        {
            var originalItem = GetCatalogItemSpecs(modifiedItem.Id);

            if (originalItem != null)
            {
                catalogItemSpecs[catalogItemSpecs.IndexOf(originalItem)] = modifiedItem;
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var productId = Convert.ToInt32(Page.RouteData.Values["id"]);

            _log.Info($"Now loading... /Catalog/Details.aspx?id={productId}");
            product   = CatalogService.FindCatalogItem(productId);
            itemSpecs = CatalogService.GetCatalogItemSpecs(product.Id);

            this.DataBind();
        }
示例#5
0
 protected void Save_Click(object sender, EventArgs e)
 {
     if (ModelState.IsValid)
     {
         var catalogItemSpecs = new CatalogItemSpecs()
         {
             Id           = Convert.ToInt32(Page.RouteData.Values["id"]),
             Polyphony    = Polyphony.Text,
             Oscillators  = Oscillators.Text,
             Lfo          = Lfo.Text,
             Effects      = Effects.Text,
             Keyboard     = Keyboard.Text,
             Memory       = Memory.Text,
             DateProduced = int.Parse(DateProduced.Text)
         };
         CatalogService.UpdateCatalogItemSpecs(catalogItemSpecs);
         Response.Redirect("~");
     }
 }
示例#6
0
 public void UpdateCatalogItemSpecs(CatalogItemSpecs catalogItemSpecs)
 {
     throw new NotImplementedException();
 }
示例#7
0
 public int CreateCatalogItemSpecs(CatalogItemSpecs itemSpecs)
 {
     throw new NotImplementedException();
 }