public JObject AddRolesInfo([FromBody] RolesEntity _userRoleEntity) { DataResult result = new DataResult() { Verifiaction = false }; try { if (_rolesRepsonsityService.IsExists(x => x.RolesName == _userRoleEntity.RolesName)) { result.Message = "角色名称已经存在!"; return(JObject.FromObject(result)); } RolesEntity userRoleEntity = new RolesEntity { ID = Guid.NewGuid().ToString(), RolesName = _userRoleEntity.RolesName, CreateDate = DateTime.Now.ToString(), Remark = _userRoleEntity.Remark }; _rolesRepsonsityService.Insert(userRoleEntity); result.Verifiaction = true; result.Message = "写入成功!"; } finally { } return(JObject.FromObject(result)); }
public string RolesTest() { try { RolesEntity rolesEntity = new RolesEntity(); rolesEntity.ID = Guid.NewGuid().ToString(); rolesEntity.RolesName = "张三"; rolesEntity.UpdateDate = DateTime.Now.ToString(); _rolesRepsonsityService.Insert(rolesEntity); _rolesRepsonsityService.SaveChange(); } catch (Exception ex) { } return("成功"); }