private void FormCreateZakaz_Load(object sender, EventArgs e)
 {
     try
     {
         List <PokupatelViewModel> listC = serviceC.GetList();
         if (listC != null)
         {
             comboBoxClient.DisplayMember = "PokupatelFIO";
             comboBoxClient.ValueMember   = "Id";
             comboBoxClient.DataSource    = listC;
             comboBoxClient.SelectedItem  = null;
         }
         List <OutputViewModel> listP = serviceP.GetList();
         if (listP != null)
         {
             comboBoxProduct.DisplayMember = "OutputName";
             comboBoxProduct.ValueMember   = "Id";
             comboBoxProduct.DataSource    = listP;
             comboBoxProduct.SelectedItem  = null;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
        public ActionResult Create()
        {
            var outputs    = new SelectList(outputService.GetList(), "Id", "OutputName");
            var pokupatels = new SelectList(pokupatelService.GetList(), "Id", "PokupatelFIO");

            ViewBag.Outputs    = outputs;
            ViewBag.Pokupatels = pokupatels;
            return(View());
        }
 private void LoadData()
 {
     try
     {
         List <PokupatelViewModel> list = service.GetList();
         if (list != null)
         {
             dataGridView.DataSource              = list;
             dataGridView.Columns[0].Visible      = false;
             dataGridView.Columns[1].AutoSizeMode =
                 DataGridViewAutoSizeColumnMode.Fill;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
 // GET: Customers
 public ActionResult Index()
 {
     return(View(service.GetList()));
 }