public PermissionTypeDTO ToDTO(PermissionTypeEntity entity) { PermissionTypeDTO dto = new PermissionTypeDTO(); dto.CreateTime = entity.CreateTime; dto.Description = entity.Description; dto.Id = entity.Id; dto.Name = entity.Name; return(dto); }
public async Task <bool> DelByNameAsync(string name) { using (MyDbContext dbc = new MyDbContext()) { PermissionTypeEntity permissionType = await dbc.GetAll <PermissionTypeEntity>().SingleOrDefaultAsync(i => i.Name == name); if (permissionType == null) { return(false); } permissionType.IsDeleted = true; await dbc.SaveChangesAsync(); return(true); } }