Пример #1
0
        // GET: Ingredients/Edit/5
        public ActionResult Edit(int id)
        {
            var viewModel    = service.GetElement(id);
            var bindingModel = new ResourseBindingModel
            {
                ResourseId    = id,
                ResourseName  = viewModel.ResourseName,
                ResoursePrice = viewModel.ResoursePrice
            };

            return(View(bindingModel));
        }
Пример #2
0
 private void FormResourse_Load(object sender, EventArgs e)
 {
     if (id.HasValue)
     {
         try
         {
             ResourseViewModel view = service.GetElement(id.Value);
             if (view != null)
             {
                 textBoxName.Text = view.ResourseName;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
     }
 }
Пример #3
0
        private Decimal CalcSum(int resourseId, int resourseCount)
        {
            ResourseViewModel resourse = resoursesService.GetElement(resourseId);

            return(resourseCount * resourse.ResoursePrice);
        }