Exemplo n.º 1
0
        public ActionResult UpdateAccess(ASMUpdateAccessViewModel model)
        {
            if (!Request.IsAjaxRequest())
            {
                return(RedirectToAction("Index"));
            }

            AlertMessage alert = new AlertMessage();

            ASMBusiness business = new ASMBusiness();

            if (!ModelState.IsValid)
            {
                alert.Text = string.Join(System.Environment.NewLine, ModelState.Values
                                         .SelectMany(v => v.Errors)
                                         .Select(e => e.ErrorMessage));
            }
            else
            {
                business.SetUserAuth(ViewBag.UserAuth);

                alert = business.UpdateAccess(model);
            }

            return(new MyJsonResult(alert, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult Add(ASMViewModel model)
        {
            AlertMessage alert = new AlertMessage();

            ASMBusiness business = new ASMBusiness();

            if (!ModelState.IsValid)
            {
                alert.Text = string.Join(System.Environment.NewLine, ModelState.Values
                                         .SelectMany(v => v.Errors)
                                         .Select(e => e.ErrorMessage));
            }
            else
            {
                business.SetUserAuth(ViewBag.UserAuth);

                alert = business.Add(model);
            }

            TempData["AlertMessage"] = alert;

            if (alert.Status == 1)
            {
                return(RedirectToAction("Index"));
            }

            ViewBag.ListRayonType = business.GetListRayonType();

            return(View("Edit", model));
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            ASMBusiness business = new ASMBusiness();

            business.SetUserAuth(ViewBag.UserAuth);

            ViewBag.IsEditable = business.IsEditable();

            return(View());
        }
Exemplo n.º 4
0
        public ActionResult Datatable(JDatatableViewModel model)
        {
            if (!Request.IsAjaxRequest())
            {
                return(RedirectToAction("Index"));
            }

            JDatatableResponse resp = new JDatatableResponse();

            ASMBusiness business = new ASMBusiness();

            business.SetUserAuth(ViewBag.UserAuth);

            resp = business.GetDatatableByQuery(model);

            return(new MyJsonResult(resp, JsonRequestBehavior.AllowGet));
        }