예제 #1
0
        public string Post([Bind] Sys_GroupModel group)
        {
            var success = string.Empty;
            var model   = new Sys_GroupEntity
            {
                ID         = group.ID,
                Code       = group.Code,
                GroupName  = group.GroupName,
                IsActivate = group.IsActivate
            };
            var service = new Sys_GroupServices();

            if (group.ID != Guid.Empty)
            {
                group.ID = group.ID;
                success  = service.Edit <Sys_GroupEntity>(model) + ",1";
            }
            else
            {
                success  = service.Add <Sys_GroupEntity>(model) + ",0";
                group.ID = model.ID;
            }

            return(success);
        }
예제 #2
0
        public ActionResult Add([Bind] Sys_GroupModel model)
        {
            var service = new RestServiceClient <Sys_GroupModel>(UserLogin);

            service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
            var result = service.Put(_hrm_Sys_Service, "api/Sys_Group/", model);

            return(Json(result));
        }
예제 #3
0
        public ActionResult Edit([Bind] Sys_GroupModel group1)
        {
            var service = new RestServiceClient <Sys_GroupModel>(UserLogin);

            service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
            var result = service.Put(_hrm_Sys_Service, "api/Sys_Group/", group1);

            return(View(result));
        }
예제 #4
0
 public ActionResult Create(Sys_GroupModel model)
 {
     if (ModelState.IsValid)
     {
         var service = new RestServiceClient <Sys_GroupModel>(UserLogin);
         service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
         var result = service.Put(_hrm_Sys_Service, "api/Sys_Group/", model);
         ViewBag.MsgInsert = "Insert success";
     }
     return(View());
 }
예제 #5
0
        public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Sys_GroupModel model)
        {
            //if (ModelState.IsValid)
            //{
            var service = new RestServiceClient <Sys_GroupModel>(UserLogin);

            service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
            var result = service.Put(_hrm_Sys_Service, "api/Sys_Group/", model);

            //return Json(result);
            //ViewBag.MsgUpdate = "Update success";
            //}
            return(Json(result));
        }
예제 #6
0
        // GET api/<controller>/5
        public Sys_GroupModel Getbyid(Guid id)
        {
            var service       = new Sys_GroupServices();
            var result        = service.GetSysGroupById(id);
            var sysGroupModel = new Sys_GroupModel
            {
                ID         = result.ID,
                Code       = result.Code,
                GroupName  = result.GroupName,
                IsActivate = result.IsActivate,
                Notes      = result.Notes
            };

            return(sysGroupModel);
        }
예제 #7
0
        public ActionResult Edit([Bind] Sys_GroupModel group1)
        {
            var isAccess = CheckPermission(UserId, PrivilegeType.Modify, ConstantPermission.Sys_Group);

            if (!isAccess)
            {
                return(PartialView("AccessDenied"));
            }
            var service = new RestServiceClient <Sys_GroupModel>();

            service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
            var result = service.Put(_hrm_Sys_Service, "api/Sys_Group/", group1);

            return(View(result));
        }
예제 #8
0
        public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Sys_GroupModel model)
        {
            var isAccess = CheckPermission(UserId, PrivilegeType.Modify, ConstantPermission.Sys_Group);

            if (!isAccess)
            {
                return(PartialView("AccessDenied"));
            }
            //if (ModelState.IsValid)
            //{
            var service = new RestServiceClient <Sys_GroupModel>();

            service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
            var result = service.Put(_hrm_Sys_Service, "api/Sys_Group/", model);

            //return Json(result);
            //ViewBag.MsgUpdate = "Update success";
            //}
            return(Json(result));
        }
예제 #9
0
        public Sys_GroupModel Put(Sys_GroupModel model)
        {
            var group = new Sys_GroupEntity
            {
                ID         = model.ID,
                Code       = model.Code,
                GroupName  = model.GroupName,
                IsActivate = model.IsActivate,
            };
            var service = new Sys_GroupServices();

            if (model.ID != Guid.Empty)
            {
                group.ID = model.ID;
                service.Edit <Sys_GroupEntity>(group);
            }
            else
            {
                service.Add <Sys_GroupEntity>(group);
            }

            return(model);
        }