Exemplo n.º 1
0
        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();
        }
    }
Exemplo n.º 3
0
    //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"]);
    }
Exemplo n.º 4
0
    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";
        }
    }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
 /// <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);
 }