private KomlectModel Convert(KomlectViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new KomlectModel
            {
                Id = model.Id,
                KomlectName = model.KomlectName,
                Price = model.Price
            });
        }
 private void CalcSum()
 {
     if (comboBoxKomlect.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
     {
         try
         {
             int id = Convert.ToInt32(comboBoxKomlect.SelectedValue);
             KomlectViewModel product = ClientApi.GetRequest <KomlectViewModel>($"api/main/getproduct?productId={id}");
             int count = Convert.ToInt32(textBoxCount.Text);
             textBoxSum.Text = (count * product.Price).ToString();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
 private void CalcSum()
 {
     if (comboBoxKomlect.SelectedValue != null &&
         !string.IsNullOrEmpty(textBoxCount.Text))
     {
         try
         {
             int id = Convert.ToInt32(comboBoxKomlect.SelectedValue);
             KomlectViewModel Komlect = logicP.Read(new KomlectConcreteBindingModel
             {
                 Id =
                     id
             })?[0];
             int count = Convert.ToInt32(textBoxCount.Text);
             textBoxSum.Text = (count * Komlect?.Price ?? 0).ToString();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
     }
 }