Ejemplo n.º 1
0
        public virtual ActionResult Create(ReceivingSetting model, string repository, string @return)
        {
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                if (ModelState.IsValid)
                {
                    Manager.Add(Repository, model);
                    resultData.RedirectUrl = @return;
                }
            });

            return Json(data);
        }
Ejemplo n.º 2
0
        public virtual ActionResult Delete(ReceivingSetting[] Model)
        {
            ModelState.Clear();
            var data = new JsonResultData(ModelState);

            data.RunWithTry((resultData) =>
            {
                if (Model != null)
                {
                    foreach (var m in Model)
                    {
                        m.Repository = Repository;
                        Manager.Remove(Repository, m);
                    }
                    resultData.ReloadPage = true;
                }
            });
            return Json(data);
        }
Ejemplo n.º 3
0
        public virtual ActionResult Delete(ReceivingSetting[] Model)
        {
            var entry = new JsonResultEntry();

            try
            {
                if (Model != null)
                {
                    foreach (var m in Model)
                    {
                        m.Repository = Repository;
                        Manager.Remove(Repository, m);
                    }
                }
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }
            return Json(entry);
        }
Ejemplo n.º 4
0
        public virtual ActionResult Create(ReceivingSetting model, string repository)
        {
            var entry = new JsonResultEntry();
            if (ModelState.IsValid)
            {
                try
                {
                    Manager.Add(Repository, model);
                    entry.SetSuccess();
                }
                catch (Exception e)
                {
                    entry.AddException(e);
                }
            }
            else
            {
                entry.AddModelState(ModelState);
            }

            return Json(entry);
        }
Ejemplo n.º 5
0
        public virtual ActionResult Edit(ReceivingSetting model, string @return)
        {
            var data = new JsonResultData(ModelState);

            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    model.Repository = Repository;
                    Manager.Remove(Repository, model);
                    Manager.Add(Repository, model);
                    resultData.RedirectUrl = @return;
                });
            }

            return Json(data);
        }