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("~"); } }
public int CreateCatalogItemSpecs(CatalogItemSpecs itemSpecs) { var maxId = catalogItemSpecs.Max(i => i.Id); itemSpecs.Id = ++maxId; catalogItemSpecs.Add(itemSpecs); return(maxId); }
public void UpdateCatalogItemSpecs(CatalogItemSpecs modifiedItem) { var originalItem = GetCatalogItemSpecs(modifiedItem.Id); if (originalItem != null) { catalogItemSpecs[catalogItemSpecs.IndexOf(originalItem)] = modifiedItem; } }
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(); }
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("~"); } }
public void UpdateCatalogItemSpecs(CatalogItemSpecs catalogItemSpecs) { throw new NotImplementedException(); }
public int CreateCatalogItemSpecs(CatalogItemSpecs itemSpecs) { throw new NotImplementedException(); }