Esempio n. 1
0
        public async Task <ActionResult> Add()
        {
            InitSelect();
            InitBody();
            var model = new EM_User_Role();

            return(View("AddOrEdit", model));
        }
Esempio n. 2
0
        public async Task <ActionResult> Edit(EM_User_Role model, string CompanyIds, string ProgramIds)
        {
            var entity = userRoleRepo.GetById(model.Id);

            entity            = Mapper.Map <EM_User_Role, EM_User_Role>(model, entity);
            entity.CompanyIds = CompanyIds;
            userRightRepo.UpdateUserRoleRight(model.Id, ProgramIds);
            var result = userRoleRepo.SaveChanges();

            return(Json(new { code = 1 }));
        }
Esempio n. 3
0
        public async Task <ActionResult> Add(EM_User_Role model, string CompanyIds, string ProgramIds)
        {
            model.CompanyIds = CompanyIds;
            userRoleRepo.Add(model);
            var result = userRoleRepo.SaveChanges();

            userRightRepo.UpdateUserRoleRight(model.Id, ProgramIds);
            if (result > 0)
            {
                return(Json(new { code = 1 }));
            }
            else
            {
                return(Json(new { code = 0, message = "保存失败,请重试" }));
            }
        }