Пример #1
0
        public ActionResult Edit(int id)
        {
            var dataCallMetric         = _dataCallMetricService.GetById(id);
            DataCallMetricViewModel vm = PrepareViewModel(dataCallMetric);

            return(View(vm));
        }
Пример #2
0
 public ActionResult Edit(DataCallMetricViewModel vm)
 {
     if (ModelState.IsValid)
     {
         _dataCallMetricService.Update(vm.DataCallMetric);
         return(RedirectToAction("Index"));
     }
     return(View(vm));
 }
Пример #3
0
        public ActionResult Create()
        {
            var vm = new DataCallMetricViewModel();

            vm.DataCallMetric = new DataCallMetric()
            {
                IDText = "0"
            };
            return(View(vm));
        }
Пример #4
0
        protected virtual DataCallMetricViewModel PrepareViewModel(DataCallMetric dataCallMetric)
        {
            if (dataCallMetric == null)
            {
                throw new ArgumentNullException("DataCallMetric");
            }

            var model = new DataCallMetricViewModel
            {
                DataCallMetric = dataCallMetric
            };

            return(model);
        }
Пример #5
0
        public ActionResult Create(DataCallMetricViewModel VM)
        {
            DataCallMetric dataCallMetric = VM.DataCallMetric;

            if (ModelState.IsValid)
            {
                _dataCallMetricService.Insert(dataCallMetric);
                return(RedirectToAction("Index"));
            }
            else
            {
                var errors = ModelState.Values.SelectMany(v => v.Errors);
            }
            return(View(dataCallMetric));
        }