public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerName,CountryListId")] Customerlist customerlist) { if (id != customerlist.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customerlist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerlistExists(customerlist.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CountryListId"] = new SelectList(_context.Countrylist, "Id", "CountryName", customerlist.CountryListId); return(View(customerlist)); }
protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None; customer = Customerlist.getCustomerList(); if (!IsPostBack) { this.displayCustomer(); } }
//Gets your list. public static Customerlist getCustomerList() { Customerlist cu = (Customerlist)HttpContext.Current.Session["Customers"]; if (cu == null) { HttpContext.Current.Session["Customers"] = new Customerlist(); } return((Customerlist)HttpContext.Current.Session["Customers"]); }
protected void btnAddContact_Click(object sender, EventArgs e) { Customerlist list = Customerlist.getCustomerList(); if (list != null) { list.Additem(getSelectedCustomer()); lblAdded.Visible = true; lblAdded.Text = getSelectedCustomer().Name + " has been added to the contact list"; } }
public async Task <IActionResult> Add([Bind("Id,CustomerName,CountryListId")] Customerlist customerlist) { if (ModelState.IsValid) { _context.Add(customerlist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CountryListId"] = new SelectList(_context.Countrylist, "Id", "CountryName", customerlist.CountryListId); return(View(customerlist)); }
/// <summary> /// basic set up of the blacklistpage /// </summary> public BlacklistPage() { InitializeComponent(); if (BlackListCB.Checked == true) { blackListTxtBox.Enabled = true; } blackListPanel.Location = new Point( ClientSize.Width / CENTER_OFFSET - blackListPanel.Size.Width / CENTER_OFFSET, (ClientSize.Height / CENTER_OFFSET - blackListPanel.Size.Height / CENTER_OFFSET) + BAR_OFF_SET); foreach (var item in Controllers.UserControl.GetAllCustomer()) { Customerlist.Items.Add(item); } Customerlist.SetSelected(0, true); }