Exemplo n.º 1
0
        public override JsonResult Save(EmployeeModel Model, string command, InfraStructure.UserProfile profile)
        {
            if (Model.ID != 0)
            {
                //  ModelState["password"].Errors.Clear();
                ModelState["LoginName"].Errors.Clear();
                ModelState["Email"].Errors.Clear();
                ModelState["strUserRoles"].Errors.Clear();
            }

            if (ModelState.IsValid)
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                if (Model.strUserRoles != null)
                {
                    Model.UserRoles = js.Deserialize <List <int> >(Model.strUserRoles);
                }
                Model.UserId = profile.Id;
                //Model.ActionName = "AddEdit";
                Model.ActionName = this.ControllerContext.HttpContext.Request.UrlReferrer.ToString();

                var ID = _CU_EmployeeService.Save(Model);

                return(Json(new { ID, command }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { ID = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult Get(int page, int count, Dictionary <string, string> sorting, Dictionary <string, string> filter, InfraStructure.UserProfile prof)
        {
            var         result  = _permissionService.Permission(sorting, filter);
            UserProfile profile = (UserProfile)HttpContext.Session["_Profile"];
            var         d       = new
            {
                count = 30,
                data  = result
            };
            var URL = this.ControllerContext.HttpContext.Request.UrlReferrer.PathAndQuery;

            _logService.Read(URL, profile.Id);

            return(Json(d, JsonRequestBehavior.AllowGet));
        }