コード例 #1
0
ファイル: Create.aspx.cs プロジェクト: wesimon01/SynthShop
        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
ファイル: CatalogService.cs プロジェクト: wesimon01/SynthShop
 public void UpdateCatalogItemSpecs(CatalogItemSpecs catalogItemSpecs)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
ファイル: CatalogService.cs プロジェクト: wesimon01/SynthShop
 public int CreateCatalogItemSpecs(CatalogItemSpecs itemSpecs)
 {
     throw new NotImplementedException();
 }