/// <summary> /// Inserts an attribute /// </summary> /// <param name="attribute">attribute</param> public virtual void InsertAttribute(GenericAttribute attribute) { if (attribute == null) { throw new ArgumentNullException(nameof(attribute)); } //_genericAttributeRepository.Insert(attribute); //cache //_cacheManager.RemoveByPattern(GENERICATTRIBUTE_PATTERN_KEY); //event notification _eventPublisher.EntityCreated(attribute); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <returns></returns> public CreateServicePerformanceResponse CreateServicePerformance(CreateServicePerformanceRequest request) { using (var client = DbFactory.GetClient()) { var servicePerformance = new ServicePerformanceMonitor(); servicePerformance.Name = request.Name; servicePerformance.ElapsedMs = request.ElapsedMs; servicePerformance.HttpRequestId = request.HttpRequestId; servicePerformance.AddTime = request.AddTime; servicePerformance.Id = client.Insertable(servicePerformance).ExecuteReturnBigIdentity(); //_cacheManager.RemoveOnEntityCreated<ServicePerformance>(); _eventPublisher.EntityCreated(servicePerformance); return(new CreateServicePerformanceResponse()); } }
/// <summary> /// 插入 /// </summary> /// <param name="request"></param> /// <returns></returns> public ServResult CreateCategory(ServRequest <CreateCategoryDto> request) { var category = new Category { Name = request.Data.Name, Alias = request.Data.Alias, Description = request.Data.Description, ParentId = request.Data.ParentId }; using (var client = DbFactory.GetClient()) { category.Id = client.Insertable(category).ExecuteReturnBigIdentity(); } UpdatePathByCategoryId(category.Id); _distributedCache.Remove(CACHE_CATEGORY_ALL_KEY); _eventPublisher.EntityCreated(category); return(Ok()); }
/// <summary> /// 插入 /// </summary> /// <param name="dto"></param> /// <returns></returns> public PublicResult CreateCategory(CreateCategoryDto dto) { var category = new Category { Name = dto.Name, Alias = dto.Alias, Description = dto.Description, ParentId = dto.ParentId }; using (var client = DbFactory.CreateClient()) { category.Id = client.Insertable(category).ExecuteReturnBigIdentity(); } UpdatePathByCategoryId(category.Id); _distributedCache.Remove(CACHE_CATEGORY_ALL_KEY); _eventPublisher.EntityCreated(category); return(Ok()); }
/// <summary> /// /// </summary> /// <param name="dto"></param> /// <returns></returns> public PublicResult CreateAdminMenu(CreateAdminMenuDto dto) { var adminMenu = new AdminMenu { Name = dto.Name, ParentId = dto.ParentId, Link = dto.Link, OrderIndex = dto.OrderIndex, Icon = dto.Icon }; using (var client = DbFactory.CreateClient()) { adminMenu.Id = client.Insertable(adminMenu).ExecuteReturnBigIdentity(); } UpdatePathByMenuId(adminMenu.Id); _eventPublisher.EntityCreated(adminMenu); return(Ok()); }
/// <summary> /// 插入 /// </summary> /// <param name="dto"></param> /// <returns></returns> public PublicResult CreateRole(CreateRoleDto dto) { var role = new Role { Name = dto.Name, IsActive = dto.IsActive, Code = dto.Code, IsAdmin = dto.IsAdmin, IsSystem = false }; using (var client = DbFactory.CreateClient()) { role.Id = client.Insertable(role).ExecuteReturnBigIdentity(); } _distributedCache.Remove(PermissionService.CACHE_ROLE_PERMISSION_ALL_KEY); _distributedCache.Remove(CACHE_ROLE_ALL_KEY); _eventPublisher.EntityCreated(role); return(Ok()); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <returns></returns> public ServResult CreateAdminMenu(ServRequest <CreateAdminMenuDto> request) { var adminMenu = new AdminMenu { Name = request.Data.Name, ParentId = request.Data.ParentId, Link = request.Data.Link, OrderIndex = request.Data.OrderIndex, Icon = request.Data.Icon }; using (var client = DbFactory.GetClient()) { adminMenu.Id = client.Insertable(adminMenu).ExecuteReturnBigIdentity(); } _eventPublisher.EntityCreated(adminMenu); return(Ok()); }
/// <summary> /// 插入 /// </summary> /// <param name="request"></param> /// <returns></returns> public ServResult CreatePermission(ServRequest <CreatePermissionDto> request) { var permission = new Permission { Name = request.Data.Name, Code = request.Data.Code, IsActive = request.Data.IsActive, ParentId = request.Data.ParentId, OrderIndex = 0, IsSystem = false }; using (var client = DbFactory.GetClient()) { permission.Id = client.Insertable(permission).ExecuteReturnBigIdentity(); } _distributedCache.Remove(CACHE_ROLE_PERMISSION_ALL_KEY); _distributedCache.Remove(CACHE_PERMISSION_ALL_KEY); _eventPublisher.EntityCreated(permission); return(Ok()); }