Ejemplo n.º 1
0
        public ActionResult AddMethod([DataSourceRequest] DataSourceRequest request, ConfigDeliveryMethodModel model)
        {
            try
            {
                if (model != null)
                {
                    var service = new ConfigDeliveryMethodService();

                    var method = DataTransfer.Transfer<Config_Delivery_Method>(
                        model,
                        typeof(ConfigDeliveryMethodModel));

                    model.ID = service.Add(method);
                }

                return Json(new[] { model }.ToDataSourceResult(request, ModelState));
            }
            catch
            {
                return View();
            }
        }
Ejemplo n.º 2
0
        public ActionResult QueryMethod([DataSourceRequest] DataSourceRequest request)
        {
            var service = new ConfigDeliveryMethodService();

            var list = service.QueryAll();
            if (list != null)
            {
                var modelList = new List<ConfigDeliveryMethodModel>();

                foreach (var config in list)
                {
                    modelList.Add(
                        DataTransfer.Transfer<ConfigDeliveryMethodModel>(
                            config,
                            typeof(Config_Delivery_Method)));
                }

                return Json(modelList.ToDataSourceResult(request));
            }

            return this.Json(string.Empty);
        }
Ejemplo n.º 3
0
        public ActionResult RemoveMethod(int id, FormCollection collection)
        {
            try
            {
                var service = new ConfigDeliveryMethodService();

                service.Remove(id);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Ejemplo n.º 4
0
        public ActionResult ModifyMethod([DataSourceRequest] DataSourceRequest request, ConfigDeliveryMethodModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                var service = new ConfigDeliveryMethodService();

                var method = DataTransfer.Transfer<Config_Delivery_Method>(
                    model,
                    typeof(ConfigDeliveryMethodModel));

                service.Modify(method);
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }